retrieve latitude and longitude from google latitude
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;
精彩评论