Reputation: 23
Since this morning, I have an issue on one of my script using Curl. The error is "Unknown SSL protocol error in connection to example.com:443".
I tried to force SSL VERSION 3 but the result is the same.
curl_setopt($curl, CURLOPT_SSLVERSION,3);
Here is my code :
$url = "https://example.com/abc/abc";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE );
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_ENCODING, 'UTF-8');
curl_setopt($curl, CURLOPT_SSLVERSION,3);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json2send);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$part4 = curl_exec($curl);
I tried with a command and it's the same :
curl -I -v --sslv3 https://example.com/abc/abc
* About to connect() to example.com port 443 (#0)
* Trying X.X.X.X...
* connected
* Connected to example.com (X.X.X.X) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* Unknown SSL protocol error in connection to example.com:443
* Closing connection #0
curl: (35) Unknown SSL protocol error in connection to example.com:443
I don't know what to do now ... or how to track this bug in a better way
Curl version
curl 7.26.0 (x86_64-pc-linux-gnu) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
PHP Version
PHP 5.4.36-0+deb7u3 (cli) (built: Jan 9 2015 08:07:06)
OpenSSL Version
OpenSSL 1.0.1e 11 Feb 2013
I tried on too more servers with Curl 7.36 & 7.37 and have the same issue. I don't find solution ...
Thank you
Upvotes: 1
Views: 1649
Reputation: 320
Maybe the server you're trying to connect to does not support SSL (which is likely the case)
Have you tried to use TLS 1/1.1/1.2 instead?
Also please post the output of
openssl version
Upvotes: 1