user451555
user451555

Reputation: 308

Curl get other website instead requested

I try load page http://ars-sps.ru/all-contact via php CURL, but in result CURL return webpage http://legaljapan.jp.

How can it be?

PHP code:

    $headers = array(
        'Expect:',
        'Accept: text/html,application/xhtml+xml,application/xml;q=0.9',
        'Accept-Language: ru,en-us;q=0.7,en;q=0.7',
        'Accept-Charset: utf-8,windows-1251;q=0.7,*;q=0.5',
    );

    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_URL, 'http://ars-sps.ru/all-contact' );
    curl_setopt($ch, CURLOPT_PORT, 80);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); 
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090716 Ubuntu/9.04 (jaunty) Shiretoko/3.5.1');
    curl_setopt($ch, CURLOPT_VERBOSE, 2); 
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
    curl_setopt($ch, CURLOPT_MAXREDIRS, 7); 
    curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_COOKIEFILE, 'curl_cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'curl_cookie.txt');

    echo $page = curl_exec($ch);

Upvotes: 1

Views: 32

Answers (1)

BetaDev
BetaDev

Reputation: 4674

Dont use "CURLOPT_USERAGENT" param then.

Upvotes: 1

Related Questions