如何使用PHP获取我的所有Google商家帐户评论(curl)

时间:2017-06-12 07:05:11

标签: php google-api

我需要获取我的Google商家帐户评论。我使用了地方API方法

$parameters = "key=$api_key&placeid=$place_id";
$place_id = trim($place_id,' ');
$api_key = trim($api_key,' ');
$url = "https://maps.googleapis.com/maps/api/place/details/json?key=$api_key&placeid=$place_id";  
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);
curl_close($ch);
$res = json_decode($result,true);
return $res;

仅返回前5条评论。但我需要得到我所有的商业评论。所以我去下面链接" https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews" 。

这里我如何找到account_name和location_name,然后为执行curl传递什么参数(如访问令牌等)。请帮助我获取所有商家评论。

0 个答案:

没有答案