Google地方api不会返回评论或评分

时间:2013-12-10 16:06:37

标签: php json google-maps google-places-api

我刚才注意到的是我们的Google +页面是https://plus.google.com/101505653197189425411/about

但是api返回的google +页面是 https://plus.google.com/118350519387987879004/about?hl=en-US

谷歌加页面都是针对我们公司的我不确定第二个谷歌+页面是什么,但它没有任何评论,所以这是有道理的,为什么没有从api返回任何评论。

我们想在我们公司的网站上显示我们的一些谷歌评论,但我只能获得有关我们公司的信息,没有评级或评论被退回。我们在谷歌+页面上有评论以及谷歌搜索中为我们提供的评论,所以我知道我们有评论。我正在尝试使用google places 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);

这是从$ 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"
  }

1 个答案:

答案 0 :(得分:1)

这是一个问题,我们在Google地方的同一位置有多个google plus页面。