<?php
 function openstreetGeocode($lat,$lng){
		$address = "";
		
                $strURL = 'http://nominatim.openstreetmap.org/reverse?format=json&lat='.$lat.'&lon='.$lng.'&zoom=18&addressdetails=1';
               // http://nominatim.openstreetmap.org/reverse?format=json&lat=18.5203&lon=73.8567&zoom=18&addressdetails=1
                echo $strURL;
		$resURL = curl_init();
		curl_setopt($resURL, CURLOPT_URL, $strURL);
		curl_setopt($resURL, CURLOPT_RETURNTRANSFER, true);
		$xmlstr = curl_exec($resURL);
		$GeoArray = json_decode($xmlstr);
                $address .=$GeoArray->display_name;
                if($address!=""){
			return $address;
		}else{
			return '';
		}	
	}
        
$address = openstreetGeocode('18.5203',' 73.8567');
echo "Hi..".$address;
?>

