开发者

cURL PHP and cURL

I'm having a strange issue. I'm 开发者_开发问答working heavily with PHP cURL, and I have a website that I just can't open.

            $ch = curl_init();
            curl_setopt( $ch, CURLOPT_URL, $url );
            @unlink("/tmp/cookies.txt");
            curl_setopt( $ch, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
            curl_setopt( $ch, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");
            curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
            curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 30 );
            curl_setopt( $ch, CURLOPT_TIMEOUT, 30 );
            curl_setopt( $ch, CURLOPT_HEADER, 0);
            curl_setopt( $ch, CURLOPT_REFERER, "http://www.gmail.com");
            curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/3.5.0.1");
            curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
            $page = curl_exec( $ch );
            $info = curl_getinfo($ch);

$info returns :

[url] => MASKED
[content_type] => 
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0

I installed on the server regular cURL. So if I do curl domain.com

It works !! It's the same domain. I tried clearing up the firewall, and also having cURL use FRESH_CONNECT so it pulls the latest IP for the domain. Still a no go. Ideas ?


The ip of your server could be blocked.

Did you try :

 curl_setopt( $ch, CURLOPT_REFERER, $url);

So the referrer is the actual domain ?

Could you give me the domain name so I could test the problem?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜