How to get distance between two places using Google Maps

Are you looking for getting distance between two places using google map, just use the below php code for action.

Use curl to use google map api to get the distance.
Here the format of address
$address = $value[“street”].” “.$value[“region”].” “.$value[“country_id”].” “.$value[“zip_code”];

Now just paste the code

$url = “”.str_replace(‘ ‘, ‘+’, $source_address).”&destination=”.str_replace(‘ ‘, ‘+’, $destination_address).”&sensor=false”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
$response_all = json_decode($response);
// print_r($response);
$distance = $response_all->routes[0]->legs[0]->distance->text;