谷歌设置API
正在寻找 Google Sets API。不幸的是谷歌没有提供这一服务。
最好是 PHP。
我正在使用这个脚本,但它今天停止工作了,我认为 Google 屏蔽了我的从我的机器访问 Google Sets 的 IP。尝试访问 Google Sets 时,它会返回以下警告消息:
Warning: fopen(http://labs.google.com/sets?hl=en&q1=java&btn=Small+Set+(15+items+or+fewer)): failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable
但奇怪的是,当我从浏览器打开 Google Sets 时,它会毫无问题地打开,并且我可以在其中执行查询。
问题出在哪里?
如何解决?
最后有谁知道从 PHP 获取 Google Sets 结果的最佳方法是什么?
太感谢了。
更新1 刚刚也找到了 this PHP 类,但错误消息是相同的:
Warning: file_get_contents(http://labs.google.com/sets?hl=es&q1=bmw&q2=ferrari): failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable
所以,我认为唯一的问题是 Google 管理员(代理)屏蔽了我的 IP。
Looking for a Google Sets API. Unfortunately Google doesn't provide one.
Preferably for PHP.
I was using this script but it stopped working today, I think Google blocked my IP to access to Google Sets from my machine. It returns following warning message when trying to access Google Sets:
Warning: fopen(http://labs.google.com/sets?hl=en&q1=java&btn=Small+Set+(15+items+or+fewer)): failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable
But strangely when I open Google Sets from the browser it opens up without any problem and I could perform query in it.
Where is the problem?
How to resolve it?
And finally does anyone know which is the best way to get results of Google Sets from PHP?
Thank you so much.
UPDATE 1
Have just found this PHP class also, but the error message is the same:
Warning: file_get_contents(http://labs.google.com/sets?hl=es&q1=bmw&q2=ferrari): failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable
So, I think the only problem is that Google Administrator (Agent) blocked my IP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据 Google 实验室使用条款(集合所属):
除非您与他们有明确协议,否则当他们发现您使用不当时,他们可以检查并阻止您使用该服务。
According to Google Labs Terms of Use (in which Sets belongs):
Unless you have an explicit agreement with them, they can check and block your usage of the service when they notice you use it improperly.
我的猜测是,谷歌正在检测到您的请求不是来自网络浏览器,从而阻止您。一般来说,谷歌会阻止对试图查询和抓取数据的脚本的访问。
我不推荐这样做,但您也许可以通过您的请求来欺骗用户代理(可能使用 cURL)。
My guess is that Google is detecting that your request is not coming from a web browser and thus blocking you. Generally Google will block access to scripts attempting to query and scrape data.
I don't recommend it, but you might be able to spoof a user-agent with your request (possibly using cURL).