0
我使用谷歌时区API来检索时区,我的代码是在谷歌时区API总是返回错误状态
$lat = round($location['lat'], 2);
$lng = round($location['lng'], 2);
$url = "https://maps.googleapis.com/maps/api/timezone/jsonlocation=".$lat.",".$lng."&timestamp=1419283200&sensor=false";
$url = str_replace(' ','',$url);
$json_timezone = file_get_contents($url);
echo $url;
echo '<pre>';print_r($json_timezone);
,输出是
https://maps.googleapis.com/maps/api/timezone/json?location=39.29,-76.64×tamp=1419283200&sensor=false
{
"status" : "INVALID_REQUEST"
}
当我运行上面URL,我得到正确的输出
{
"dstOffset" : 0,
"rawOffset" : -18000,
"status" : "OK",
"timeZoneId" : "America/New_York",
"timeZoneName" : "Eastern Standard Time"
}
任何想法如何解决这个
这就是它..谢谢 –
谢谢。这帮助了我。 – solar411