Geocode在我的新主机上没有使用php

时间:2012-03-30 14:36:51

标签: php geocode

我在PHP中使用谷歌地理编码脚本在我以前的主机上工作(仍在工作),但在hostgator中停止了我的VPS工作。

$url="http://maps.googleapis.com/maps/api/geocode/json?address=?Toronto,+ON&sensor=true";
$latlon = @file_get_contents($url);
$latlong =json_decode($latlon, true);

我也尝试过:

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL, $url);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle, CURLOPT_HEADER, 0);
$latlong = curl_exec($curl_handle);
curl_close($curl_handle);

两者都给出了

{
  "status": "REQUEST_DENIED",
  "results": [ ]
}

我尝试了Yahoo API,它确实有效! (但@file_get_contents也不适用于雅虎。)

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

似乎您每天限制调用google允许的webservice已过期。