2012-09-23 42 views
0

我在遍历数组时很糟糕,可以使用一些帮助。使用PHP通过YQL API(JSON)进行交互

我使用YQL API(雅虎)

下面是我想要遍历JSON:

http://query.yahooapis.com/v1/public/yql?q=select%20 *%20from%20yahoo.finance.historicaldata%20where%20symbol%20% 3D%20%22AAPL%22%20和%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

试图获得“Close”值。

试过,但没有奏效:$ json->查询 - >结果 - >关闭

由于提前, 菲尔

+0

奇怪... print_r($ json-> query-> results-> quote-> Close);这在我的机器上工作。 $ json是json_decode('url返回的字符串'); –

回答

0

print_r($ json-> query-> results-> quote-> Close)做到这一点。这是一个愚蠢的问题 - 抱歉浪费大家的时间。

0

在数据读取它,

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