What is the quickest way to determine the distance between UK post codes as an array of data.
I am running a loop of individual requests (about 200) but it slows the page down.
I want a single destination and an array of destinations ideally.
$result = array();
$url = “https://maps.googleapis.com/maps/api/distancematrix/json?key=$api_key&origins=$zip1&destinations=$zip2&mode=$commute_mode&language=en-GB&sensor=false”;
$data = @file_get_contents($url);
$result = json_decode($data, true);
$distance = $result[‘rows’][0][‘elements’][0][‘distance’][‘value’];