如何获取 Google Place URL 中的 cid?

发布于 2024-12-13 12:58:01 字数 373 浏览 1 评论 0原文

我想向 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

薄荷梦 2024-12-20 12:58:02

以下是获取某个地点的 cid 的方法。输入您自己的 API 密钥和您想要查找 cid 的餐厅名称)。

第 1 步:调用类似这样的 Places Request API

https://maps.googleapis.com/maps/api/place/search/json?
    location=47.6757453,-122.3149514&
    radius=500&
    types=food&
    name=Pies&
    sensor=false&
    key=AIzaSyZZZZZZZZZZZZ

这些网址是一行。它们被分成多行,以便于阅读。

注意 name 参数是一家名为“Pies and Pints”的餐厅,我想获取该餐厅的 cid,lat&lng 是同一地点的位置信息。

响应将包含一个“参考”密钥,该密钥对于每个地方都是唯一的。

第2步:获取上面的“reference”值并调用Places Details API,如下所示:

https://maps.googleapis.com/maps/api/place/details/json?
    reference=CnRiAAAATIbN_GasBkBS6xLoO_HzR7owHvGaDXbG5QIbLf7eSZtIc4ZpvbBPxhVPEKZs5c4ptqxeKNVLCXZEoSOwLMn9nqkRc6khFuJFPh5jy-hjrh3Xr7X75w3-TIoTl3E-dKiZ2LcHuReWKZxydI75vH6zyRIQxfoiOKfFjo_1O-hnnllafxoU9tU_HoZos8C5uWextAk08RMukCY&
    sensor=true&
    key=AIzaSyBnI5DyG7ZZZZZZZZZZZZ

检查此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

https://maps.googleapis.com/maps/api/place/search/json?
    location=47.6757453,-122.3149514&
    radius=500&
    types=food&
    name=Pies&
    sensor=false&
    key=AIzaSyZZZZZZZZZZZZ

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:

https://maps.googleapis.com/maps/api/place/details/json?
    reference=CnRiAAAATIbN_GasBkBS6xLoO_HzR7owHvGaDXbG5QIbLf7eSZtIc4ZpvbBPxhVPEKZs5c4ptqxeKNVLCXZEoSOwLMn9nqkRc6khFuJFPh5jy-hjrh3Xr7X75w3-TIoTl3E-dKiZ2LcHuReWKZxydI75vH6zyRIQxfoiOKfFjo_1O-hnnllafxoU9tU_HoZos8C5uWextAk08RMukCY&
    sensor=true&
    key=AIzaSyBnI5DyG7ZZZZZZZZZZZZ

Check the response of this API, the key "url" contains the "cid".


Consult the google places documentation to learn more about their APIs.

别念他 2024-12-20 12:58:02

该 URL 看起来不再包含 CID,而是包含 plus.google.com 链接

It looks like the URL no longer contains the CID but rather the plus.google.com link

吾家有女初长成 2024-12-20 12:58:02

要在 Google Maps Places Details API 中获取 CID,您只需在 fields 参数中传递 URL 值即可。这将为您提供特定位置的 URL,并在那里您可以找到 CID。

"url": "https://maps.google.com/?cid=12XXXXXXXXXXXXXXX"

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.

"url": "https://maps.google.com/?cid=12XXXXXXXXXXXXXXX"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文