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

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

问题描述

我想发送一个请求到谷歌的地方(不是google place API),我不需要用XML或JSON获取数据,我只想获取地点页面并将其显示给用户。



此网址适用于我 http ://maps.google.com/maps/place?cid = 2124238351431937390 ,但我想知道如何获得这个cid,这似乎是一个业务的唯一ID。我去了谷歌地方API的示例响应,但没有找到与任何响应字段相同的业务这个CID。



有谁知道我怎么能得到这个cid?



感谢
Nishant

解决方案

以下是如何获取某个地点的cid。将自己的API密钥和想要查找cid的餐馆名称)。

第1步:调用Places请求API

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

这些网址只有一行。它们被分成多行以方便阅读。

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



响应包含一个参考键,这是每个地方都是独一无二的。



第2步:从上面获取参考值并调用Places Details API,如下所示:

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

检查此API的响应,关键字url包含cid。






请参阅google位置文档以了解更多关于其API的信息。


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

解决方案

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.

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

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