Google Places API - 查找公司的CID和LRD [英] Google Places API - Find a company's CID and LRD

查看:143
本文介绍了Google Places API - 查找公司的CID和LRD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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


  1. 转至 https:// maps.google.com 并搜索业务

  2. 在浏览器的URL中找到 data 参数并提取组件它符合以下模式: 0x [HEX_CODE1]:0x [HEX_CODE2]

  3. 我们刚刚提取的两部分数字是公司的LRD 。现在,从该数字中取 HEXCODE_2 并将十六进制转换为十进制数。这给了我们公司的CID。

很明显,这个过程并没有得到谷歌官方的支持,如果我需要,为许多企业做到这一点。是否有人有更好的方法?

://stackoverflow.com/questions/7989930/how-to-get-the-cid-in-the-google-place-url>如何获取Google Place URL中的cid?



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



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



LRD是十六进制的CID。你可以使用这个函数:

pre $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ('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);
}
返回$ hexval;
}

因此,您可以像这样构建Google Review网址:

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


Does anybody know how to find a company's CID and/or LRD using the Google Places API?

The best solution I've come up with so far is this:

  1. Go to https://maps.google.com and search for the business
  2. Find the data parameter in the browser's URL and extract the component that matches this pattern: 0x[HEX_CODE1]:0x[HEX_CODE2]
  3. The 2-part number we just extracted is the company's LRD. Now, take HEXCODE_2 from that number and convert the hex to decimal. This gives us the company's CID.

Obviously this process isn't officially supported by Google, and wouldn't scale well if I needed to do it for many businesses. Does anybody have a better method?

解决方案

Read this article to obtain the CID: How to get the cid in the Google Place URL?

Two API requests and you'll have the CID of a business programmatically.

EDIT ----------

The LRD is CID in hexadecimal. You can use this function to:

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;
}

So you can build the Google Review Url like this:

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

这篇关于Google Places API - 查找公司的CID和LRD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆