如何获取 Google Place URL 中的 cid?
我想向 google 地点发送请求(不是 google 地点 API),我不需要获取 XML 或 JSON 格式的数据,我只想获取地点页面并将其显示给用户。
此网址适合我 http://maps.google.com/maps/place?cid= 2124238351431937390 但我想知道如何获取这个“cid”,这似乎是一个唯一的ID 商业。我从 google place api 获取了示例响应,但没有找到与任何响应字段相同的业务的 cid。
有谁知道我怎样才能得到这个“cid”?
谢谢 尼尚特
I want to send a request to the google places (not google place API), I don't need to get the data in XML or JSON, i just want to get the place page and display it to the user.
This url works for me http://maps.google.com/maps/place?cid=2124238351431937390 but I was wondering how to get this "cid", this seems to a unique id for a business. I went to get a sample response from the google place api but didnt find this cid for the same business as any of the response fields.
Does anyone know how can I get this "cid"?
Thanks
Nishant
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下是获取某个地点的 cid 的方法。输入您自己的 API 密钥和您想要查找 cid 的餐厅名称)。
第 1 步:调用类似这样的 Places Request API
这些网址是一行。它们被分成多行,以便于阅读。
注意
name
参数是一家名为“Pies and Pints”的餐厅,我想获取该餐厅的 cid,lat&lng 是同一地点的位置信息。响应将包含一个“参考”密钥,该密钥对于每个地方都是唯一的。
第2步:获取上面的“reference”值并调用Places Details API,如下所示:
检查此API的响应,键“url”包含“cid”。
请查阅 Google Places 文档以了解有关其 API 的更多信息。
Here's how to get the cid of a place. Put your own API key and name of the restaurant that you want to find the cid).
Step 1: Call Places Request API something like this
These urls are one line. They are broken into multiple lines to make it easier to read.
Note the
name
parameter is the restaurant called "Pies and Pints" for which I want to get the cid, lat&lng is the location information of the same place.The response will contain a "reference" key which is unique for every place.
Step 2: Take the "reference" value from above and call Places Details API, something like this:
Check the response of this API, the key "url" contains the "cid".
Consult the google places documentation to learn more about their APIs.
该 URL 看起来不再包含 CID,而是包含 plus.google.com 链接
It looks like the URL no longer contains the CID but rather the plus.google.com link
要在 Google Maps Places Details API 中获取 CID,您只需在 fields 参数中传递 URL 值即可。这将为您提供特定位置的 URL,并在那里您可以找到 CID。
To get the CID in Google Maps Places Details API you just pass the URL value in the fields parameter. This will get you the URL of the particular location and there you can find the CID.