gpt4 book ai didi

php - 我在这段代码中使用的是 API V2 还是 V3?

转载 作者:行者123 更新时间:2023-12-03 09:07:02 24 4
gpt4 key购买 nike

我的 live、staging 和 localhost 有一个页面,其中有一个 map 和商店查找器。

6 个月后,这现在不起作用并且没有触及代码。我已经更新了我的 API key ,但仍然没有运气。现在我知道 API V2 现在没有使用,我想知道我是否使用了错误的代码(我自己很困惑)。在我的商店查找器中,我有这个网址:
$url = "http://maps.google.co.uk/maps/geo?q=".urlencode($this->input->post('postcode'))."&output=json&key=MYKEY" ;

现在阅读此页面(https://developers.google.com/maps/documentation/geocoding/#JSON),这已经改变,但我似乎无法获得有效的网址!

我得到的错误是:Message: file_get_contents(http://maps.google.co.uk/maps/geo?q=sr3+4as&output=json&key=MYKEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
当我在谷歌中输入 url 字符串时,我会收到以下消息:

We're sorry...

... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.

如果有人可以指导我,如果我的 url 字符串在上面是错误的,或者如果这是另一个问题,我将不胜感激。

谢谢!

最佳答案

根据the upgrade guide此端点 URL:
http://maps.google.co.uk/maps/geo

正在使用 v2 地理编码 API。

Developers switching from v2 may be using a legacy hostname — either maps.google.com, or maps-api-ssl.google.com if using SSL. You should migrate to the new hostname: maps.googleapis.com.



这个基于更新指南中信息的 URL 对我有用:

http://maps.googleapis.com/maps/api/geocode/json?address=nebraska&sensor=false

关于php - 我在这段代码中使用的是 API V2 还是 V3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19564234/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com