-1
我已經使用下面給出的代碼來獲取計算兩地之間駕駛距離的地方的經度和緯度。在兩個地方之間的駕駛距離在PHP不起作用
function get_coordinates($city, $street, $province)
{
$address = urlencode($city.','.$street.','.$province);
$url = "http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false®ion=Poland";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
$response_a = json_decode($response);
$status = $response_a->status;
if ($status == 'ZERO_RESULTS')
{
return FALSE;
}
else
{
$return = array('lat' => $response_a->results[0]->geometry->location->lat, 'long' => $long = $response_a->results[0]->geometry->location->lng);
return $return;
}
}
我不明白這一點。它顯示一個空數組。當echo $狀態時,我得到'OVER_QUERY_LIMIT'。 此代碼在godaddy服務器中完美工作。 Iam在我將其更改爲網絡解決方案服務器時遇到這些錯誤。 如何解決這個問題?
感謝
但它是在另一臺服務器使用相同的API – Ranju
這是因爲IP地址。 Google通過IP跟蹤API限制。您的本地IP與服務器的IP不同。本地和服務器上的API使用已經耗盡,但仍有剩餘使用量。 – Samir
一個是我們公司的服務器是godaddy,另一個是客戶端是網絡解決方案。 thia正在godaddy.but而不是在網絡解決方案中工作。 – Ranju