2

每當我在Safari和Google Chrome的私人窗口中運行網址https://scholar.google.com/citations?user=N7m4vIQAAAAJ&hl=en時,Google都會給出錯誤信息。Google服務器在隱私瀏覽模式下提供服務器錯誤

它只發生在隱私瀏覽模式下的第一個請求。

有人知道爲什麼只有在特定的環境中才會發生這種情況嗎? 3天前發生這種事情。

- 錯誤消息,並且捕獲

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.

enter image description here

enter image description here

---附加

頭文件包括

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

+1

這似乎從頁面R. 拉內容時'庫(HTTR)'' RES = GET來也發生('https://scholar.google。 (res)' 'res2 = GET('https://scholar.google.com/citations?hl=zh-CN&user=qZLGnroAAAAJ')' 'content(content/resations/hl = zh_CN&user = qZLGnroAAAAJ')' ' res2)' 這個錯誤是在R'scholar'包的github中報告的(請參閱https://github.com/jkeirstead/scholar/issues/23)。 – Bastien

+0

@Bastien謝謝,我在GitHub上閱讀了你的報告。如您所知,當我在同一個標​​籤中請求兩次時,我可以看到要檢索的內容。同樣,我們也使用腳本來檢索數據。它不適用於我們的腳本。兩次電話也不是最好的答案。你有其他想法嗎? – Karl

+0

是的,此刻我不知道。似乎是來自谷歌服務器的最近問題。但我的專業知識是超有限的,所以唯一的建議是打電話兩次。確實,這很醜陋,但希望第一個電話實際上並不需要太多時間。如果我聽到更多信息(例如,如果與開發人員或我報告的問題一起報告了問題,我們會找到解決方案),我會在此處發佈。 – Bastien

回答

1

通過在請求URL時提供cookie來解決問題。 REF:PHP cURL how to add the User Agent value OR overcome the Servers blocking cURL requests?

我使用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); 
+0

嗨,我試圖使用你的腳本,但它一直給我一個空的$數據,你在curl_setopt中添加了什麼嗎?我可能錯過了什麼? – user1868607

+0

@ user1868607不,這是我使用的全部。你能告訴$ url的值嗎? – Karl

+0

我不知道這是否可以幫助某人,但我解決了它添加curl_setopt($ curl,CURLOPT_SSL_VERIFYPEER,false); – user1868607