我已经设置了一个小型 PHP 脚本,用于通过 CURL 使用 google 地理编码 API 验证用户提交的地址信息。
https://developers.google.com/maps/documentation/geocoding/#GeocodingRequests
使用每个 IP 每天获得的正常配额,一切正常。但是,每当我尝试使用 API key 进行身份验证时,我都会收到 REQUEST_DENIED 响应。
响应成功
http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Agadir
请求被拒绝
http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Agadir&key={my_api_key}
我已经将我的项目设置为允许访问该服务 (Google Maps API v3),但我肯定远未达到每日配额。我也 100% 确定我的 API key 是正确的。
有谁知道 API key 是否需要一些时间来传播?
最佳答案
您需要base64_decode()
API key ,然后对 URL 进行签名。 Working code from Google .
关于php - 使用身份验证时 Google map 地理编码 API 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10499524/