I just need a little help with json and php. How do i echo certian parts of data if my request comes back looking like this:
{ "data": { "current_condition": [ {"cloudcover": "2", "humidity": "54", "observation_time": "09:05 PM", "precipMM": "0.0", "pressure": "1019", "temp_C": "11", "visibility": "10", "weatherCode": "113", "weatherDesc": [ {"value": "Clear" } ], "weatherIconUrl": [ {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0008_clear_sky_night.png" } ], "winddir16Point": "N", "winddirDegree": "350", "windspeedKmph": "15", "windspeedMiles": "9" } ], "request": [ {"query": "48.85,2.35", "type": "LatLon" } ] }}
I am using a weather API, my code currently looks like:
$weather_url = file_get_contents("http://free.worldweatheronline.com/feed/weather.ashx?q=xxxxx&format=json&num_of_days=2&key=xxxxxxxxxxxxxxxxxx");
$json_output_w = json_decode($weather_url, true);
the q in the url string can be a zipcode, lat and long, or a city, i know it is returning data because i can dump the variable $json_output_w; but i just need a little guidance as how to actually echo certain parts of the data that is returned. like say i wanted to echo
windspeedMiles
var_dump($json_output_w);?var_dump()to inspect your array.