0
votes

I'm terrible at iterating through arrays and could use some help.

I'm using the YQL API (Yahoo)

Here's the json that i'm trying to iterate:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22AAPL%22%20and%20startDate%20%3D%20%222012-09-20%22%20and%20endDate%20%3D%20%222012-09-20%22&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys

Trying to get the "Close" value.

Tried this but didn't work: $json->query->results->Close

Thanks in advance, Phil

2
Strange... print_r($json->query->results->quote->Close); this works on my machine. where $json is json_decode('string returned by this url'); - Glavić

2 Answers

0
votes

fetch it in to data,

    data['query']['results']['quote']['Close']
0
votes

print_r($json->query->results->quote->Close) does it. This was a stupid question - sorry for wasting everyone's time.