Geocode在我的新主机上不使用php
我让PHP中的google地理编码脚本在我以前的主机上工作(仍在工作),但在hostgator中停止了对VPS的工作Geocode在我的新主机上不使用php,php,geocode,Php,Geocode,我让PHP中的google地理编码脚本在我以前的主机上工作(仍在工作),但在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=cur
$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": [ ]
}
我试过YahooAPI,效果很好!(但是@file\u get\u contents
也不适用于雅虎)
如有任何帮助,我们将不胜感激。看来,谷歌允许的每天呼叫Web服务的限制已经过期 这与sensor param无关,因为我通过浏览器尝试了相同的url,它返回结果!那么,相同的代码在您的本地机器上工作吗?还是从另一个网络主机?