phpsslcurlhttps

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


I'm trying to make a post to an external url using curl, the external page use https, here is the description 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 makes 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)

I checked firebug for the response and it says

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

Here is the code I'm using

ob_start();
    
// 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);

Solution

  • 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_PROXYAUTH, CURLAUTH_NTLM );
    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