[英]Google Place Photo Requests Broken?
We are attempting to use the Google Place Photo Requests 我们正在尝试使用Google Place Photo Requests
( https://developers.google.com/places/documentation/photos#place_photo_requests )
( https://developers.google.com/places/documentation/photos#place_photo_requests )
API to fetch photos, but are constantly getting the quota exceeded image. 用于获取照片的API,但不断获取超出配额的图像。
We have signed up for a paid account, as well as set up a brand new account, and continue to get this error. 我们已经注册了一个付费帐户,并建立了一个新帐户,并继续出现此错误。
To reproduce we: 要复制我们:
1) First ran the Place Details request from the server (/maps/api/place/details/json) via PHP. 1)首先通过PHP从服务器(/ maps / api / place / details / json)运行“地点详细信息”请求。
2) Then from this result set we fetched the (['result']['photos'][0]['photo_reference'])
photoreference. 2)然后从该结果集中获取
(['result']['photos'][0]['photo_reference'])
光参考。
3) With the photoreference, key, sensor and maxwidth variables we called /maps/api/place/photo (via PHP). 3)使用photoreference,key,sensor和maxwidth变量,我们将其称为/ maps / api / place / photo (通过PHP)。
We can not seem to get this to work. 我们似乎无法使它正常工作。 Has anybody else successfully used this or has any advice?
有没有其他人成功使用过这个或有任何建议?
Sounds like you are either sending us a lot of requests, or you aren't adding your key to the photo fetch. 听起来您要么向我们发送了很多请求,要么就没有将密钥添加到照片获取中。 Have you had any successful requests?
您有任何成功的请求吗? If not, I'd suspect your keys are missing and/or incorrect.
如果没有,我怀疑您的钥匙丢失和/或不正确。
Try this code.. It works for me 试试这个代码。对我有用
<h3>Images From Google </h3>
<?php
$company_name = 'walmart';
$data_ref = file_get_contents("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=Latitude ,Longitude&radius=100&name=".$company_name."&types=store&sensor=false&key=MYKEY");
$data_ref_de = json_decode($data_ref);
if($data_ref_de->status=='OK')
{
foreach($data_ref_de->results as $result)
{
if(isset($result->photos) && count($result->photos))
{
foreach($result->photos as $photos)
{?>
//Display Image
<img src="https://maps.googleapis.com/maps/api/place/photo?maxwidth=600&photoreference=<?php echo $photos->photo_reference; ?>&sensor=true&key=MYKEY" />
<?php
}
}
}
}
And also be sure that you have enabled the Places API
Service 另外,请确保已启用
Places API
服务
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.