<?php$from = "erode";$to = "Chennai";$from = urlencode($from);$to = urlencode($to);$data = file_get_contents("http://maps.googleapis.com/maps/api/distancematrix/json?origins=$from&destinations=$to&language=en-EN&sensor=false");$data = json_decode($data);$time = 0;$distance = 0;foreach($data->rows[0]->elements as $road) { $time += $road->duration->value; $distance += $road->distance->value;}$km=$distance/1000;echo "To: ".$data->destination_addresses[0];echo "<br/>";echo "From: ".$data->origin_addresses[0];echo "<br/>";echo "Time: ".$time." seconds";echo "<br/>";echo "Distance: ".$distance." meters";echo "<br/>";echo $km;?>https://stackoverflow.com/questions/...late-distances