Friday, April 19, 2013

Get County from User Lat Long

In Mobile application how the server knows about the posted device country and response then as per the location.

Get the current location of the device and use google map api to get user location. Get location from the ipaddress is a worth thing now. because all the internet user use proxy network.



$cur_lat =$_REQUEST['lat'];
$cur_lon = $_REQUEST['lon'];

$output= json_decode($geocode);

        $country = $output->results[0]->address_components[$j]->short_name;

echo $country;


Yup... You get the country id..