【发布时间】:2011-02-20 16:16:55
【问题描述】:
你好,我做错了。
我想从这个返回的 json 结果中获取 totalResults
全文:http://code.google.com/apis/customsearch/v1/using_rest.html
"request": [
{
"title": "Google Custom Search - flowers",
"totalResults": 10300000,
"searchTerms": "flowers",
}
]
},
我试过这个:
$response = file_get_contents('https://www.googleapis.com/customsearch/v1?key=INSERT-YOUR-KEY&cx=013036536707430787589:_pqjad5hr1a&q=flowers&alt=json
');
$json = json_decode($response);
echo "Total Result:".$json->request->totalResults;
但我什么都没有。 需要帮助。谢谢。
【问题讨论】:
-
您是否将密钥插入到
INSERT-YOUR-KEY的位置? -
是的,我确实插入了 api 密钥。只是不知道如何只显示总结果;
标签: php google-search-api