3

Im trying to visit the following page using php curl 7.35.0 using the following code:

    $this->ch = curl_init();
    curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 3000);
    curl_setopt($this->ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36");
    curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($this->ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
    curl_setopt($this->ch, CURLOPT_TIMEOUT, 3600);
    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($this->ch, CURLOPT_URL, 'https://asp.reflexion.net/login');
    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
    $content  = curl_exec($this->ch);
    $httpCode = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
    if ($errno    = curl_errno($this->ch))
    {
        $error_message = curl_strerror($errno);
        echo "cURL error ({$errno}):\n {$error_message}";
    }
    echo "<br>";
    echo "http code: " . $httpCode . "<br>";
    echo "content: " . $content;

Which returns the following:

cURL error (35): SSL connect error

http code: 0 content:

Did anyone run into this problem before?

3
  • That error code means a Time out. Your network connection to that host is most likely faulty. There might be a problem with the SSL libraries used by the curl bindings in PHP. Commented Sep 24, 2014 at 6:08
  • How do I troubleshoot this? it looks like I cant access that page with no problems using Chrome. Commented Sep 24, 2014 at 7:20
  • 2
    "Did anyone run into this problem before?" - let's check, shall we? Commented Sep 24, 2014 at 8:44

4 Answers 4

3

Adding

curl_setopt($this->ch, CURLOPT_SSLVERSION , 3);

solve my issue.

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

1 Comment

If you scroll down to CURLOPT_SSLVERSION at php.net you can see: Setting it to 2 or 3 is very dangerous given the known vulnerabilities in SSLv2 and SSLv3.
2

usually, this is an firewall issue. SSL connection is banned by network administrator.

1 Comment

can you pls explain a bit more how to fix this issue?
2

This worked for me: yum update nss

Source: https://serverfault.com/a/642203

1 Comment

Centos 6.4 here, this fixed it for me.
0

This solved my issue as well.

Our environment

PHP 5.3.3 libcurl 7.19.7-46 google-api-php-client 1.1.5

Deep within the Google API Client Curl code, httpd would die inside the curl_exec(). After changing CURLOPT_SSLVERSION from 1 to 3, all is well :)

1 Comment

php.net/manual/en/function.curl-setopt.php Note: Your best bet is to not set this and let it use the default. Setting it to 2 or 3 is very dangerous given the known vulnerabilities in SSLv2 and SSLv3.

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.