google-maps - Google Places API - 查找公司的 CID 和 LRD

标签 google-maps google-api google-plus google-places-api

有人知道如何使用 Google Places API 查找公司的 CID 和/或 LRD 吗?

到目前为止我想出的最佳解决方案是:

  1. 转到https://maps.google.com并搜索商家
  2. 在浏览器 URL 中查找 data 参数并提取与此模式匹配的组件:0x[HEX_CODE1]:0x[HEX_CODE2]
  3. 我们刚刚提取的两部分编号是该公司的 LRD。现在,从该数字中取出 HEXCODE_2 并将十六进制转换为十进制。这为我们提供了公司的 CID。

显然,此流程并未得到 Google 的正式支持,如果我需要为许多企业执行此流程,则无法很好地扩展。有没有人有更好的方法?

最佳答案

阅读本文以获取 CID: How to get the cid in the Google Place URL?

两个 API 请求,您将以编程方式获得企业的 CID。

编辑----------

LRD 是十六进制的 CID。您可以使用此功能来:

function dec2hex($number)
{
    $hexvalues = array('0','1','2','3','4','5','6','7',
               '8','9','A','B','C','D','E','F');
    $hexval = '';
     while($number != '0')
     {
        $hexval = $hexvalues[bcmod($number,'16')].$hexval;
        $number = bcdiv($number,'16',0);
    }
    return $hexval;
}

因此您可以像这样构建 Google 评论网址:

$business_url = "https://www.google.com/search?q=NAMEOFBUSINESS&ludocid=YOURCID#lrd=0x0:0xYOURHEXCID,1";

关于google-maps - Google Places API - 查找公司的 CID 和 LRD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38579952/

相关文章:

google-maps - 无法在谷歌地图中使用 setMap(null) 或 setVisible(false) 清除标记

Python、Google Places API - "Invalid request. One of the input parameters contains a non-UTF-8 string"

ios - 如何在 Google Map iOS SDK 中获取特定的标记 ID

json - 带有 R 的 Google 地方

android - Google Plus +1 Google Play 应用程序?

html - G 加分享按钮不是 W3C 有效

javascript - 单击按钮启动 Google 登录

javascript - 如何执行 Google Maps 基于区域的聚类或标记重叠

google-api - 使用google oauth登录后如何获取用户id

google-api - Google OAuth2 中缺少 refresh_token .Net HttpPost 对 access_token 的请求