0

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 ?

1 Answer 1

1

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?

Sign up to request clarification or add additional context in comments.

1 Comment

Yes I did. I added a lot of extra settings as well, like verbose display, and I can't figure it out. Sorry, no domain, as it runs on a development server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.