[英]Google places api doesn't return reviews or ratings
Something I just noticed is that our google+ page is https://plus.google.com/101505653197189425411/about 我刚刚注意到的是,我们的google +页面是https://plus.google.com/101505653197189425411/about
but the google+ page returned by the api is https://plus.google.com/118350519387987879004/about?hl=en-US 但是api返回的google +页面是https://plus.google.com/118350519387987879004/about?hl=zh-CN
both google plus pages are for our company I'm not sure what the second google+ page is but it does not have any reviews so that makes sense why there aren't any reviews returned from the api. 这两个google plus页面都适用于我们公司,我不确定第二个google +页面是什么,但是它没有任何评论,因此可以理解为什么api没有返回任何评论。
We would like to show some of our google reviews on the website for our company but I can only get information about our company, no ratings or reviews are returned. 我们想在我们公司的网站上显示一些Google评论,但我只能获得有关我们公司的信息,不会返回任何评分或评论。 We have reviews on our google+ page as well as reviews that come up for us in a google search so I know we have reviews.
我们在Google+页面上有评论,以及在Google搜索中为我们显示的评论,所以我知道我们有评论。 I'm trying to use the google places api.
我正在尝试使用Google Places API。 I did the places search to get a reference, I turned on the places api in the console, generated a key in the api access and set up some IPs to allow.
我进行了位置搜索以获得参考,我在控制台中打开了位置api,在api访问中生成了一个密钥,并设置了一些允许的IP。 I use curl to make the call.
我用curl打电话。
$request = 'https://maps.googleapis.com/maps/api/place/details/json?reference=CoQBegAAANKTKgF4XccOIERYeXixRttRcupjpiAnouwQJIqlPcM9BrFlHGMI2Css2lUhTfVVut65SCYB4CVxnMzk3hro24fijoTO15Fk7GWpqv9cgu7A0MltCVa1vNk6RrH8_5LRcea7u2LgbWtb5N6G109eif3ifOHzf09lTE1OdNIPR57qEhBkD6dtfnctIEd5IQEEW8RDGhRT0wWXkqYMtqJ2h901WR9kdWOKdw&sensor=false&key=supersecretapikey';
$session = curl_init();
curl_setopt($session, CURLOPT_URL, $request);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_SSLVERSION,3);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($session, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($session, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($session, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
$response = curl_exec($session);
//echo curl_getinfo($session). '<br/>';
//echo curl_errno($session). '<br/>';
//echo curl_error($session). '<br/>';
curl_close($session);
var_dump($response);
this is what is dumped from $response 这是从$ response中转储的内容
{
"debug_info": [],
"html_attributions": [],
"result": {
"address_components": [
{
"long_name": "2805",
"short_name": "2805",
"types": [
"street_number"
]
},
{
"long_name": "Washington Boulevard",
"short_name": "Washington Boulevard",
"types": [
"route"
]
},
{
"long_name": "Ogden",
"short_name": "Ogden",
"types": [
"sublocality",
"political"
]
},
{
"long_name": "Ogden",
"short_name": "Ogden",
"types": [
"locality",
"political"
]
},
{
"long_name": "Weber County",
"short_name": "Weber County",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "UT",
"short_name": "UT",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "US",
"short_name": "US",
"types": [
"country",
"political"
]
},
{
"long_name": "84401",
"short_name": "84401",
"types": [
"postal_code"
]
}
],
"formatted_address": "2805 Washington Boulevard, Ogden, UT, United States",
"formatted_phone_number": "(801) 621-6500",
"geometry": {
"location": {
"lat": 41.213974,
"lng": -111.970847
}
},
"icon": "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id": "ce471d4942919106311349a18d805be7046a61bf",
"international_phone_number": "+1 801-621-6500",
"name": "Hertz Car Sales Ogden UT",
"opening_hours": {
"open_now": true,
"periods": [
{
"close": {
"day": 1,
"time": "2000"
},
"open": {
"day": 1,
"time": "0900"
}
},
{
"close": {
"day": 2,
"time": "2000"
},
"open": {
"day": 2,
"time": "0900"
}
},
{
"close": {
"day": 3,
"time": "2000"
},
"open": {
"day": 3,
"time": "0900"
}
},
{
"close": {
"day": 4,
"time": "2000"
},
"open": {
"day": 4,
"time": "0900"
}
},
{
"close": {
"day": 5,
"time": "2000"
},
"open": {
"day": 5,
"time": "0900"
}
},
{
"close": {
"day": 6,
"time": "1900"
},
"open": {
"day": 6,
"time": "0900"
}
}
]
},
"reference": "CoQBegAAAKS_lTlHVHEBg4mUzeFpsO1VDcHdnQ0GVgGezJ-TaHbFnsvGYqvh-Yzuc1N6UF0lQQuJM0IWa1BIWmbXbs5Yvj7mhBgTph0u5ResZhFYDYSXi5q6RIlRfe1Vlj40DoHroLmAAmbfaghv-TQV7a7VH3QlOckSaCiuMwkpWX6tOGd-EhDPycK7dnAJZxnq5Jx2Tz00GhR98Y2mAkoL68NlnL-uyFeld1RvbQ",
"types": [
"establishment"
],
"url": "https://plus.google.com/118350519387987879004/about?hl=en-US",
"utc_offset": -420,
"vicinity": "2805 Washington Boulevard, Ogden",
"website": "http://www.hertzogden.com/"
},
"status": "OK"
}
这是我们的问题,因为我们在Google地方中的同一位置有多个Google Plus页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.