How get an address from latitude and longitude by using google api


Posted on 06 Aug 15 by Vickey

By using google api we can get latitude and longitude of a given location and we can also get the location details if we have latitude and longitude of that location.

With the help of below code you can get location details if you have latitude and longitude of a location

echo getAddressByLatLong('-4734774834','005347587');

public function getAddressByLatLong($loc_latitude='',loc_longitude='')
    $api_url = ''.$loc_latitude.','.$loc_longitude.'&sensor=false';
    $location_record = @file_get_contents($api_url);

    $location_status = $location_data->status;
        return $location_data->results[0]->formatted_address;
        return false;


If this post help you reduce time to develop, you can help me to maintain this website :)