【问题标题】:Google places api doesn't return reviews or ratingsGoogle Places api 不返回评论或评分
【发布时间】:2013-12-10 16:06:36
【问题描述】:

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

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

两个 google+ 页面都是针对我们公司的

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

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 谢谢。多年来一直对这个评级元素遗漏感到困惑。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-26
    • 2019-02-17
    • 2016-01-09
    • 2016-05-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多