Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (16 sloc) 489 Bytes
<?php
if (isset($_POST['lat'], $POST['lng'])){
$lat = $_POST['lat'];
$lng = $_POST['lng'];
$url = sprintf("https://maps.googleapis.com/maps/api/geocode/json?latlng=%s,%s", $lat, $lng);
$content = file_get_contents($url); //get the json content
$metadata= json_decode($content, true);
if(count($metadata['results']) > 0 ){
$result = $metadata['results'][0];
echo $result['formatted_address'];
}
else{
// no results
}
}
?>
You can’t perform that action at this time.