每当我运行该网址时https://scholar.google.com/citations?user=N7m4vIQAAAAJ&hl=en
在 Safari 和 Google Chrome 的私有窗口中,Google 会给出错误。
它仅在隐私浏览模式的第一个请求时发生。
有人知道为什么这种情况只在特定环境下发生吗?
这种情况从三天前就开始发生了。
-- 错误消息和捕获
Server Error
We're sorry but it appears that there has been an internal server error while processing your request. Our engineers have been notified and are working to resolve the issue.
Please try again later.
- - 添加
头文件包括
http header response
Cache-Control: no-cache, must-revalidate
Content-Encoding: gzip
Content-Type: text/html; charset=UTF-8
Date: Mon, 16 Nov 2015 19:35:39 GMT
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Pragma: no-cache
Server: citations
Set-Cookie: NID=73=eF98qod1NpYg7nb03RUToiSiacFgqNoZxQ4CuzqwGlQn53SoR7rHlzO0OExsmYkpRazROCQ3WqKoCsWKFPxp8dZr5pBra6nD1HPcxWUILl9gVAf5Q7GSQc3B0O3TP4gu; expires=Tue, 17-May-2016 19:35:39 GMT; path=/; domain=.google.com; HttpOnly
X-Firefox-Spdy: h2
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
p3p: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
x-content-type-options: no sniff
通过在请求 URL 时使用 cookie 解决了该问题。参考:PHP cURL 如何添加用户代理值或克服服务器阻止 cURL 请求? https://stackoverflow.com/questions/17801094/php-curl-how-to-add-the-user-agent-value-or-overcome-the-servers-blocking-curl-r
我使用 php 脚本来检索并放置一些 cookie 选项。
代码片段是
$curl = curl_init($url);
$dir = dirname(__FILE__);
$config['cookie_file'] = $dir . '/cookies/' . md5($_SERVER['REMOTE_ADDR']) . '.txt';
curl_setopt($curl, CURLOPT_COOKIEFILE, $config['cookie_file']);
curl_setopt($curl, CURLOPT_COOKIEJAR, $config['cookie_file']);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)