Weather API
Thank You Google
I love Google. Their MapAPI works great for my purposes, though I have yet utilised it as well I would have like...
Anyhow, this post is about their weather forcasting. I have been using their site to search "weather Masan Korea" to see the local weather for today and the upcoming few days.
A little search online found that Google does make their weather information available through simple XML at http://www.google.com/ig/api?weather=Masan-si,%20Korea and then you just need to parse the data. I chose PHP.
<div><div style="text-align: center; font-size: 1.2em"> <b>Weather in <u>Masan Korea</u></b></div> <?php // Load Google's XML file $weather = @simplexml_load_file("http://www.google.com/ig/api?weather=Masan-si,%20Korea"); // Collect Data for each forcasted day (which tends to include today plus three days) foreach ($weather->weather->forecast_conditions as $for) { // Best use float:left instead of a table :) echo '<div style="float: left; text-align: left; padding: 1px">'; // The day of the week echo "\t<div style=\"text-align: center\">{$for->day_of_week['data']}</div>\n"; // Google's Pic of the Weather echo "\t<div style=\"text-align: center\"><img "; echo "src=\"http://www.google.com{$for->icon['data']}\" "; echo "alt=\"{$for->condition['data']}\" /></div>\n"; // The day's high temp in both Fahrenheit and Celcius echo "\t<div>{$for->high['data']}°F / " . round(($for->high['data'] - 32) * 5 / 9, 1) . "°C</div>\n"; // The day's low temp in both Fahrenheit and Celcius echo "\t<div>{$for->low['data']}°F / " . round(($for->low['data'] - 32) * 5 / 9, 1) . "°C</div>\n"; echo "</div>\n"; } ?></div>You can see my use of the box on my home page