Want to know today’s weather? This snippet will let you know, in only 3 lines of code. The only thing you have to do is to replace ADDRESS by the desired adress, on line 1.

$xml = simplexml_load_file(‘http://www.google.com/ig/api?weather=ADDRESS’);
$information = $xml->xpath(“/xml_api_reply/weather/current_conditions/condition”);
echo $information[0]->attributes();

Advertisements