简体   繁体   中英

How to do bulk lat/long lookup for google geocoding api in PHP?

I am using this endpoint with CURL to get lat/long for specific address and it working fine but if i need to get it for 1000 records then needs to make 1000 api call is there any way i can supply json of address and get the lat/long for 1000 records in one call

https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,

+Mountain+View,+CA&key=YOUR_API_KEY

create foreach loop

$dataLocations = ["London","Slovakia","Ukraine","Kiev","New York"];

foreach($dataLocations as $location){
$url = "https://maps.googleapis.com/maps/api/geocode/json?address=".$location;
$data = file_get_contents($url);
$json = json_decode($data, true);
return $json;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM