我想使用Google Maps API从德国邮政编码获取州(下萨克森州,巴伐利亚,…)。
我尝试了这个:
$get = "http://maps.googleapis.com/maps/api/geocode/json?address=" . $zip . "&sensor=true";
$result = file_get_contents($get);
但是它也会返回其他匹配项。我想将比赛限制在德国(国家代码:)DE
。
使用此处记录的components参数:https : //developers.google.com/maps/documentation/geocoding/intro
例子:
http://maps.googleapis.com/maps/api/geocode/json?address=79098&components=country:DE
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句