I've been using the Google Distance Matrix API for a while now to calculate distances between the consumer and businesses on my website; I have currently hit a wall and seen that my quote hits 2,500
and doesn't process anymore requests after that.
I then decided to give the documentation a quick read over to see if there's anything I could do to maybe kill two birds with one stone, so to say, and seen on the API Usage Limits Page that you have have 25 origins and 25 destinations per requests.
Does this means that within one request I can concatenate 25 origins and destinations and return their miles.
Here's the PHP code I use to get the milage between the consumer and customer:
final public function Distance($A, $B){
$URL = "https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=".urlencode($A)."&destinations=".urlencode($B)."&key=API_KEY_HERE";
$Data = json_decode(file_get_contents($URL));
return str_replace(" mi", "", $Data->rows->elements->distance->text);
}