Advertisement
Guest User

Untitled

a guest
May 5th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. $state = 'NC';
  2. $city = 'Boone';
  3.  
  4. $json_string = file_get_contents("https://api.wunderground.com/api/MY-API-KEY/geolookup/conditions/q/'.$state.'/'.$city.'.json");
  5. $parsed_json = json_decode($json_string);
  6. $location = $parsed_json->{'location'}->{'city'};
  7. $temp_f = $parsed_json->{'current_observation'}->{'temp_f'};
  8. echo "Current temperature in ${location} is: ${temp_f}n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement