Google Maps API with PHP to find distance between two locations

前端 未结 3 1545
礼貌的吻别
礼貌的吻别 2021-01-07 05:23

On my current project, which is a delivery system, I have a list of available delivery drivers, which is shown on an orders page. But what I need is to show the distance eac

3条回答
  •  忘掉有多难
    2021-01-07 05:40

    You can easily calculates the distance between two address using Google Maps API and PHP.

    $addressFrom = 'Insert from address';
    $addressTo = 'Insert to address';
    $distance = getDistance($addressFrom, $addressTo, "K");
    echo $distance;
    

    You can get the getDistance() function codes from here - http://www.codexworld.com/distance-between-two-addresses-google-maps-api-php/

提交回复
热议问题