0
東西我只注意到的是,我們的谷歌+頁面https://plus.google.com/101505653197189425411/about谷歌Places API的不返回評論或評分
而是通過API返回的谷歌+頁面 https://plus.google.com/118350519387987879004/about?hl=en-US
兩個谷歌加頁是我們的公司我不確定第二個Google +頁面是什麼,但它沒有任何評論,因此,爲什麼沒有任何評論從API返回。
我們想在我們公司的網站上展示我們的一些谷歌評論,但我只能得到關於我們公司的信息,沒有評級或評論返回。我們對Google +頁面進行了評論,並在Google搜索中爲我們提供了評論,因此我知道我們有評論。我試圖使用谷歌地方API。我做了地方搜索以獲得參考資料,我打開了控制檯中的地點api,在api訪問中生成了一個密鑰,並設置了一些允許的IP地址。我用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);
這是從$響應
{
"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"
}
謝謝。一直困惑這個評級元素遺漏的年齡。 –