{"id":645,"date":"2011-08-19T23:37:30","date_gmt":"2011-08-19T14:37:30","guid":{"rendered":"http:\/\/www23.atpages.jp\/~inoni\/?p=645"},"modified":"2017-05-16T13:33:25","modified_gmt":"2017-05-16T04:33:25","slug":"wordpress%e3%81%ab%e5%a4%a9%e6%b0%97%e4%ba%88%e5%a0%b1%e8%a1%a8%e7%a4%ba%e3%82%92%e4%bb%98%e3%81%91%e3%81%a6%e3%81%bf%e3%82%8b3","status":"publish","type":"post","link":"http:\/\/anada.cloudfree.jp\/?p=645","title":{"rendered":"WordPress\u306b\u5929\u6c17\u4e88\u5831\u8868\u793a\u3092\u4ed8\u3051\u3066\u307f\u308b3"},"content":{"rendered":"<p><a href=\"http:\/\/anada.cloudfree.jp\/?p=476\" title=\"\uff12\">WordPress\u306b\u5929\u6c17\u4e88\u5831\u8868\u793a\u3092\u4ed8\u3051\u3066\u307f\u308b2<\/a>\u3067\u306f\u3001<strong>livedoor\u306eWeather Hacks<\/strong>\u3092\u4f7f\u3063\u305f\u5929\u6c17\u4e88\u5831\u8868\u793a\u3092\u8a66\u3057\u3066\u307f\u305f\u304c\u3001\u6b21\u306f<strong>Google Weather API<\/strong>\u3092\u5229\u7528\u3057\u305f\u5929\u6c17\u4e88\u5831\u8868\u793a\u3092\u8a66\u3057\u3066\u307f\u308b\u3002<br \/>\ncss\u306f\u7701\u7565\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\n\/\/ API\u304b\u3089XML\u30c7\u30fc\u30bf\u53d6\u5f97\r\n$city = 'osaka,osaka';\r\n$gpath = 'http:\/\/www.google.com';\r\n$url = $gpath . '\/ig\/api?weather=';\r\n\/\/ \u53d6\u5f97\u30c7\u30fc\u30bf\u304b\u3089\u8868\u793a\u9805\u76ee\u53d6\u5f97\r\n\r\n$xml = simplexml_load_file($url . $city);\r\n\r\n$objInfo =  $xml-&gt;weather-&gt;forecast_information;\r\n$first_date = $objInfo-&gt;forecast_date&#x5B;data];\r\n\r\necho '&lt;div&gt;in ' . strtoupper($objInfo-&gt;postal_code&#x5B;data]) . '&lt;br&gt;';\r\n\r\n$i = 0;\r\nforeach ($xml-&gt;weather-&gt;forecast_conditions as $cond) {\r\n\t$week = $cond-&gt;day_of_week&#x5B;data];\r\n\t$icon_url = $gpath . $cond-&gt;icon&#x5B;data];\r\n\t$low = $cond-&gt;low&#x5B;data];\r\n\t$high = $cond-&gt;high&#x5B;data];\r\n\t$condition = str_replace('Chance of ', '', $cond-&gt;condition&#x5B;data]);\r\n\t\r\n\techo '&lt;div&gt;';\r\n\techo '&lt;img src=&quot;' . $icon_url . '&quot; alt=&quot;icon&quot; \/&gt;';\r\n\techo '&lt;div&gt;' . '';\r\n\techo date('Y-m-d', strtotime ($first_date) + $i * 86400) .'&#x5B;' . $week . ']&lt;br&gt;' . $condition . ' ';\r\n\tif (strlen($low) &gt; 0 || strlen($high) &gt; 0) {\r\n\t\techo strlen($low)&gt;0 ? convertF2C($low) : '';\r\n\t\techo '-' ;\r\n\t\techo strlen($high)&gt;0 ? convertF2C($high) : '';\r\n\t\techo '\u2103' ;\r\n\t}\r\n\techo '&lt;\/div&gt;';\r\n\techo '&lt;\/div&gt;';\r\n\t$i++;\r\n}\r\necho '&lt;\/div&gt;';\r\n\r\n\/\/\u83ef\u6c0f\u6442\u6c0f\u5909\u63db\r\nfunction convertF2C($val) {\r\n\treturn round(($val-32)*5\/9);\r\n}\r\n?&gt;\r\n<\/pre>\n<p><span><\/span><\/p>\n<p>Google Weather API\u3067\u306f\u4eca\u65e5\u3092\u542b\u3081\u305f4\u65e5\u5206\u306e\u4e88\u5831\u304c\u53d6\u5f97\u3067\u304d\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u306b\u5929\u6c17\u4e88\u5831\u8868\u793a\u3092\u4ed8\u3051\u3066\u307f\u308b2\u3067\u306f\u3001livedoor\u306eWeather Hacks\u3092\u4f7f\u3063\u305f\u5929\u6c17\u4e88\u5831\u8868\u793a\u3092\u8a66\u3057\u3066\u307f\u305f\u304c\u3001\u6b21\u306fGoogle Weather API\u3092\u5229\u7528\u3057\u305f\u5929\u6c17\u4e88\u5831\u8868\u793a\u3092\u8a66\u3057\u3066\u307f\u308b\u3002 css\u306f\u7701 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,10,11,14],"tags":[27,48,62,78,83,134],"class_list":["post-645","post","type-post","status-publish","format-standard","hentry","category-development","category-photo","category-php","category-wordpress","tag-api","tag-google","tag-php","tag-weather","tag-wordpress","tag-134"],"_links":{"self":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=645"}],"version-history":[{"count":2,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/645\/revisions"}],"predecessor-version":[{"id":2573,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/645\/revisions\/2573"}],"wp:attachment":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}