I know this is possible in Javascript but I need to do it using only PHP, how can I?
views:
449answers:
2
+4
A:
Yes, there's a HTTP geocoding interface that you can call from any server language.
Mike Williams
2009-10-06 14:51:43
+1 for agreement.
thephpdeveloper
2009-10-06 14:56:26
Perfect! Thanks.
Andrew G. Johnson
2009-10-06 14:56:44
+2
A:
Using Google Map API and PHP to get coordinates:
$url = 'http://maps.google.com/maps/geo?q='.$address.'&output=json&oe=utf8&sensor=false&key='.$api_key;
$data = @file_get_contents($url);
$jsondata = json_decode($data,true);
if(is_array($jsondata )&& $jsondata ['Status']['code']==200){
$lat = $jsondata ['Placemark'][0]['Point']['coordinates'][0];
$lon = $jsondata ['Placemark'][0]['Point']['coordinates'][1];
}
thephpdeveloper
2009-10-06 15:00:24