![](/img/trans.png)
[英]Retrieve the latitude and longitude data from the local database and search it in the google map
[英]retrieve latitude and longitude from google latitude
我正在做一個項目,我想使用此代碼檢索緯度和經度,但它沒有返回我...請檢查此代碼
<?PHP
header('Content-Type: text/plain');
//$userkey='AIzaSyB2hw658V7RSzEYgwSHwYkaLm_505gqLhs';
//$url='https://www.googleapis.com/latitude/v1/currentLocation?key='.$userkey.'&type=json';
$userId = '30811844108.apps.googleusercontent.com';
$url = 'http://www.google.com/latitude/apps/badge/api?user='.$userId.'&type=json';
$content = file_get_contents( $url );
$json = json_decode( $content );
$coord = $json->features[0]->geometry->coordinates;
$lat = $coord[1];
$lon = $coord[0];
echo $lat.' x '.$lon;
//$newurl="http://jecrcgps.betu.tk/data.php?lat=$lat&lon=$lon";
//header("location: $newurl");exit;
?>
您確定這是正確的$ userid嗎? 我正在為該用戶$ iserid進行測試,而我剛收到“用戶標識符的格式錯誤”。
也許您應該嘗試$ userid = 30811844108;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.