OK, so you need to go an get yourself a Google Maps API Key. Have a search on here, I think several have posted the steps to go via the Google Developers Console.
Then all you need to do is use the API
https://maps.googleapis.com/maps/api/distancematrix/json
Input your origins and destinations.
Slight wrinkle in that it returns multiple “rows” so you might need to pull out the first one with “firstitem”.
{
“destination_addresses”: [
“Hove, UK”
],
“origin_addresses”: [
“Brockham, UK”
],
“rows”: [
{
“elements”: [
{
“distance”: {
“text”: “53.7 km”,
“value”: 53708
},
“duration”: {
“text”: “54 mins”,
“value”: 3266
},
“status”: “OK”
}
]
}
],
“status”: “OK”
}