Ads Inside Post

Search in This Blog

Latitude Longitude by address in php

You can find very easily Latitude and Longitude by given address with combination of Google map api and php.
You can easily implement in CodeIgniter,Laravel , CakePHP or any other framewok.

<?php
    $address = 'Sector 37,Noida,India';
    $geocode = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=true');
    $geocode  = json_decode($geocode );
    echo 'Latitude:' . $geocode ->results[0]->geometry->location->lat;
    echo 'Longitude:' . $geocode ->results[0]->geometry->location->lng;

?>