Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $state = 'NC';
- $city = 'Boone';
- $json_string = file_get_contents("https://api.wunderground.com/api/MY-API-KEY/geolookup/conditions/q/'.$state.'/'.$city.'.json");
- $parsed_json = json_decode($json_string);
- $location = $parsed_json->{'location'}->{'city'};
- $temp_f = $parsed_json->{'current_observation'}->{'temp_f'};
- echo "Current temperature in ${location} is: ${temp_f}n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement