$name=array('Colombo','Embilipitiya','Matara','Balangoda','Galle','Dehiwala','Nugegoda','Nuwaraeliya');
$x1=array();
$y1=array();
$numberOfAddress=sizeof($name);
location($name);
function location($address){
global $x1;
global $y1;
$name2=$address;
for($i=0;$i
$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$name2[$i].'+Sri+Lanka&sensor=false');
$output= json_decode($geocode);
$latitude = $output->results[0]->geometry->location->lat;
$longitude = $output->results[0]->geometry->location->lng;
$x1[]=$latitude;
$y1[]=$longitude;
}
}
?>
No comments:
Post a Comment