Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get location from lat long in php

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 111
    Comment on it

    By using google api we can find the location

    public function getAddressByLatLong($loclatitude='',loclongitude='')
    {
        $loclatitude=trim($loclatitude);
        $loclongitude=trim($loclongitude);
        $apiurl = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='.$loclatitude.','.$loclongitude.'&sensor=false';
    
        $locationrecord = @file_get_contents($apiurl);
        $locationdata=json_decode($locationrecord);
    
        $locationstatus = $locationdata->status;
        if($locationstatus=="OK")
            return $locationdata->results[0]->formatted_address;
        else
            return false;
    }
    
    
    
    
    echo $address= $this->getaddress($lat,$lng);
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: