php - 使用身份验证时 Google map 地理编码 API 不起作用

标签 php google-maps google-maps-api-3 google-api

我已经设置了一个小型 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/

相关文章:

php - mysql查询获取表1中的所有字段和表2中的部分字段

javascript - 使用ajax重新执行php循环

android - 在 android 中使用 Google Places API 查找城市名称和区域详细信息

android - 从 Google Maps API v2 MapView 更新 Google Play 服务时崩溃

php - Google Maps API 地理解码器限制

php - 使用 PHP 的最简单的双向加密

php - URL 字符串中包含 "utm_"会破坏 Wordpress 中的 $_GET 变量

android - 如何为结果启动谷歌地图

xcode - iOS 版谷歌地图崩溃

javascript - 防止 Google StreetView Javascript API 返回自定义全景图