从Google Place API

时间:2017-09-15 13:40:05

标签: php curl google-places-api

我正在使用PHP curl来获取Google Place API结果。我使用下面的代码:

$curl = curl_init();
curl_setopt_array($curl, array(
       CURLOPT_RETURNTRANSFER => 1,
       CURLOPT_URL => 'https://maps.googleapis.com/maps/api/place/textsearch/json?query=CITY&type=atm&next_page_token=40&key=KEY'
));
$resp = curl_exec($curl);
curl_close($curl);

从上面的请求我只得到20个结果,但我想要所有的结果。为了得到我用过的所有结果" next_page_token"参数如下:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=CITY&type=atm&next_page_token=20&key=KEY

以上网址仅返回接下来的20条记录,但不是全部。所以最后我只有40个记录,但我仍然无法获得所有记录。

任何人都可以帮我解决我应该如何处理网址。

0 个答案:

没有答案