如何获取 Google Place URL 中的 cid? [英] How to get the cid in the Google Place URL?

查看:25
本文介绍了如何获取 Google Place URL 中的 cid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向谷歌地点(不是谷歌地点 API)发送请求,我不需要以 XML 或 JSON 格式获取数据,我只想获取地点页面并将其显示给用户.

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.

这个网址对我有用http://maps.google.com/maps/place?cid=2124238351431937390 但我想知道如何获得这个cid",这似乎是企业的唯一 ID.我去从 google place api 获取示例响应,但没有找到与任何响应字段相同的业务的 cid.

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.

有谁知道我怎样才能得到这个cid"?

Does anyone know how can I get this "cid"?

谢谢尼桑

推荐答案

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

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).

第 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参数是我想获取cid的名为Pies and Pints"的餐厅,lat&lng是同一个地方的位置信息.

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.

第 2 步:从上面获取参考"值并调用 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的响应,keyurl"包含cid".

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

查阅谷歌地点文档以了解有关其 API 的更多信息.

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

这篇关于如何获取 Google Place URL 中的 cid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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