Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google api &引用;“301已移动”;,带有Opera的谷歌API_Google Api_Opera_Http Status Code 301_Opera Mini - Fatal编程技术网

Google api &引用;“301已移动”;,带有Opera的谷歌API

Google api &引用;“301已移动”;,带有Opera的谷歌API,google-api,opera,http-status-code-301,opera-mini,Google Api,Opera,Http Status Code 301,Opera Mini,在我的web应用程序中,我正在对谷歌(非官方)的天气API进行CURL调用,网址为: http://www.google.com/ig/api?weather=,,, ... 除了在Opera中访问相关页面外,这在所有情况下都可以正常工作。在Opera中访问时,xml响应中会出现以下内容,而不是天气: 301 Moved</H1> The document has moved <A HREF="http://www.google.com/m/ig">here</A

在我的web应用程序中,我正在对谷歌(非官方)的天气API进行CURL调用,网址为:

http://www.google.com/ig/api?weather=,,, ...
除了在Opera中访问相关页面外,这在所有情况下都可以正常工作。在Opera中访问时,xml响应中会出现以下内容,而不是天气:

301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/m/ig">here</A>.
301移动
文档已移动
.
我怎样才能解决这个问题?我在网上看到一些建议,认为清除缓存是一种解决方案,但这对我来说并不奏效。请注意,我特别关注Opera Mini


非常感谢。

更新2012-06-20:使用Opera 12进行测试,谷歌似乎已经修复了嗅探问题

我认为你修不好。了解谷歌为何会进行服务器端用户代理嗅探并将Opera重定向到另一个URI,这将是一件有趣的事情。你能粘贴完整的天气URI吗,这样我们就可以自己在Opera上测试它了?如果你在歌剧院演过的那一首,我会得到的

<xml_api_reply version="1">
<weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
<problem_cause data=""/>
</weather>
</xml_api_reply>
更多细节将有所帮助,我将在这里完成

更新2012-03-12首先,我尝试了一个简单的卷发

→ curl -sI "http://www.google.com/ig/api?weather=,,,40735500,-73986500"

HTTP/1.1 200 OK
Content-Type: text/xml; charset=ISO-8859-1
Date: Mon, 12 Mar 2012 13:16:43 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Set-Cookie: PREF=ID=9bc71bbf2edb7ebb:TM=1331558203:LM=1331558203:S=K5Ew69E5IsYhA0s8; expires=Wed, 12-Mar-2014 13:16:43 GMT; path=/; domain=.google.com
X-Content-Type-Options: nosniff
Server: igfe
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
然后使用Opera用户代理

→ curl -sI -A "Opera/9.80 (Macintosh; Intel Mac OS X 10.7.3; U; fr) Presto/2.10.229 Version/11.61" "http://www.google.com/ig/api?weather=,,,40735500,-73986500"

HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Mon, 12 Mar 2012 13:17:47 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Set-Cookie: PREF=ID=54cc62619394059e:TM=1331558267:LM=1331558267:S=JRCO-WNJMUNMMHsO; expires=Wed, 12-Mar-2014 13:17:47 GMT; path=/; domain=.google.com
X-Content-Type-Options: nosniff
Server: igfe
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
最后是Firefox用户代理

→ curl -sI -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0" "http://www.google.com/ig/api?weather=,,,40735500,-73986500"

HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Mon, 12 Mar 2012 13:20:09 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Set-Cookie: PREF=ID=ab709995945767a8:TM=1331558409:LM=1331558409:S=bom-8pa-x9gGY5Sb; expires=Wed, 12-Mar-2014 13:20:09 GMT; path=/; domain=.google.com
X-Content-Type-Options: nosniff
Server: igfe
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked

在所有情况下都没有
X-Content-Type-Options:nosniff
,也没有重定向。您正在使用的用户代理是什么。您可以在地址栏中键入about:opera,此时将显示用户代理字符串。

以下是示例的完整url:@G.Moore您能接受答案吗?:)所以我们在Opera的雷达上找不到它。谢谢!:)
→ curl -sI -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0" "http://www.google.com/ig/api?weather=,,,40735500,-73986500"

HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Mon, 12 Mar 2012 13:20:09 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Set-Cookie: PREF=ID=ab709995945767a8:TM=1331558409:LM=1331558409:S=bom-8pa-x9gGY5Sb; expires=Wed, 12-Mar-2014 13:20:09 GMT; path=/; domain=.google.com
X-Content-Type-Options: nosniff
Server: igfe
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked