我想使用 Google Maps API 从德国邮政编码获取州(下萨克森州、巴伐利亚州等)。
我尝试过这个:
$get = "http://maps.googleapis.com/maps/api/geocode/json?address=" . $zip . "&sensor=true";
$result = file_get_contents($get);
但它也会返回其他匹配项。我想将比赛限制在德国(国家/地区代码:DE
)。
最佳答案
使用此处记录的组件参数: https://developers.google.com/maps/documentation/geocoding/intro
示例:
http://maps.googleapis.com/maps/api/geocode/json?address=79098&components=country:DE
关于php - 如何使用 Google Maps API 从邮政编码获取州(德国)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34156128/