<?php 
	
$latitude 	= $_POST['latitude'];
$longitude	= $_POST['longitude'];
	
		// curl
		function curl($url){
			$ch = curl_init(); 
			curl_setopt($ch, CURLOPT_URL, $url);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
			$output = curl_exec($ch);  
			curl_close($ch);      
			return $output;
		}

		// end curl
	
		$gmap = curl('https://maps.googleapis.com/maps/api/geocode/json?latlng='.$latitude.','.$longitude.'&key=AIzaSyAssH94kOodra9mncIoHPEWbySo4Np0V-w');
		$data = json_decode($gmap,false);
		echo json_encode($data->results[0]->formatted_address);

?>
