Google Server gives a server error with the first

2019-07-03 16:49发布

问题:

Whenever I run the url https://scholar.google.com/citations?user=N7m4vIQAAAAJ&hl=en in private windows of Safari and Google Chrome, Google gives an errors.

It happens only on the first request with private browsing mode.

Anybody knows why this happens only in specific environment? This has been happening since 3 days ago.

-- an error message and a capture

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.

--- added

The header file includes

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:

Fixed the issue by having cookies when it requests URLs. REF: PHP cURL how to add the User Agent value OR overcome the Servers blocking cURL requests?

I use php scripts to retrieve and put some cookie options.

A code snippet is

    $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);