php - JSON not showing responnse -


the following code not work me.

<?php $json_string =    file_get_contents("http://api.wunderground.com/api/7ec5f6510a4656df/geolookup/forecast/q/40121    .json"); $parsed_json = json_decode($json_string); $temp = $parsed_json->{'forecast'}->{'date'}; echo "current date ${temp}\n";   ?> 

it works when put so:

$temp = $parsed_json->{'location'}->{'city'}; 

what missing here lol

it should be:

$temp = $parsed_json->{'forecast'}->{'txt_forecast'}->{'date'}; 

for better way of viewing json objects, @ this site.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -