Skip to content

Instantly share code, notes, and snippets.

@crock
Last active March 13, 2016 22:22
Show Gist options
  • Save crock/9030a164c51cf987174c to your computer and use it in GitHub Desktop.
Save crock/9030a164c51cf987174c to your computer and use it in GitHub Desktop.
Wunderground - Fetches XML file and extracts temperature and current weather condition
<?php
$xmlfeed = file_get_contents("http://api.wunderground.com/api/YOUR_API_KEY/conditions/q/FL/Orlando.xml");
$xml = simplexml_load_string($xmlfeed);
print $xml->asXML('data/Orlando.xml');
$xml = simplexml_load_file('data/Orlando.xml');
$temp = $xml->current_observation->temp_f . "&deg;F";
$weather = $xml->current_observation->weather;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment