开发者

retrieve latitude and longitude from google latitude

开发者 https://www.devze.com 2023-02-16 11:46 出处:网络
I am working on a project and i want to retrieve latitude and longitude using this code but it is not

I am working on a project and i want to retrieve latitude and longitude using this code but it is not returning me...please check this code

<?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;
?>


are you sure that is the correct $userid? i was testing for that user $iserid and i just got "Format error for user identifier."

perhaps you should try $userid = 30811844108;

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号