[英]Google Place Photo Requests Broken?
我們正在嘗試使用Google Place Photo Requests
( https://developers.google.com/places/documentation/photos#place_photo_requests )
用於獲取照片的API,但不斷獲取超出配額的圖像。
我們已經注冊了一個付費帳戶,並建立了一個新帳戶,並繼續出現此錯誤。
要復制我們:
1)首先通過PHP從服務器(/ maps / api / place / details / json)運行“地點詳細信息”請求。
2)然后從該結果集中獲取(['result']['photos'][0]['photo_reference'])
光參考。
3)使用photoreference,key,sensor和maxwidth變量,我們將其稱為/ maps / api / place / photo (通過PHP)。
我們似乎無法使它正常工作。 有沒有其他人成功使用過這個或有任何建議?
聽起來您要么向我們發送了很多請求,要么就沒有將密鑰添加到照片獲取中。 您有任何成功的請求嗎? 如果沒有,我懷疑您的鑰匙丟失和/或不正確。
試試這個代碼。對我有用
<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
}
}
}
}
另外,請確保已啟用Places API
服務
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.