curl errno 35 (Unknown SSL protocol error in connection to [secure site]:443)

i’m trying to make post to an external url using curl, the externa page use https, here is the desc of the server i’m using

Server Apache/2.2.11 (Win32) mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.3.0

the external url make a redirect to another url that i send in the post, but everytime i try i get this error

curl_errno=35 (Unknown SSL protocol error in connection to [secure site]:443)

so i check the firebug for the response and it say

Failed to load source for: http://localhost/3Party/PHP_VPC_3Party_Auth_Capture_Order_DO.php

Here is the code I’m using


// initialise Client URL object
$ch = curl_init();
// set the URL of the VPC

curl_setopt ($ch, CURLOPT_URL, $vpcURL);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $this->postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);  
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_exec ($ch);
if (curl_error($ch)) {
    $this->errorMessage = 
        "curl_errno=". curl_errno($ch) . " (" . curl_error($ch) . ")";
curl_close ($ch);

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

I think the problem is the fact that you are trying to access an “http” URL (instead of “https”) on port 443.

You can also try setting the SSL version manually:

curl_setopt($ch, CURLOPT_SSLVERSION, 3);

Replace 3 with whatever SSL version the remote server is using.

Solution 2

After a few weeks dealing with this issue, i was able to at least establish the connection, i don’t know if it is the real answer but it works for me, i just added to the example above, the options to use proxy, just like this

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, 'my.proxy');
curl_setopt($ch, CURLOPT_PROXYPORT, 'my.port');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'domain\user:password');  

hope this can help

Solution 3

It might also be tls/ssl version preference by the server. In this case, you have to try specify different version constants from here:

E.g. what worked for me was:


Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply