Thursday, June 26, 2014

google map latitude longitude php

6/26/2014


In this post PHP script convert an address to geocode Latitude/Longitude positioning with Google Maps. In response, you will be get the latitude and longitude details.

For same, you can use following php code.


<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/


$url = "http://maps.google.com/maps/api/geocode/json?address=West+Bridgford&sensor=false®ion=UK";
$result = file_get_contents($url);
$response = json_decode($result, true);

 
$latitude = $response['results'][0]['geometry']['location']['lat'];
$longitude = $response['results'][0]['geometry']['location']['lng'];
 
echo "Latitude: " . $latitude . " Longitude: " . $longitude;



?>

helpful? Share this

The Editorial Team of 4everTutorials consists of a group of PHP Professionals.

0 comments:

 

© 2014 4everTutorials. All rights resevered.

Back To Top