1

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

2
  • What php version and curl version do you have? Commented Jan 27, 2015 at 10:59
  • I edited the post, sorry Commented Jan 27, 2015 at 11:03

1 Answer 1

1

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

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

9 Comments

You mean the openssl version of my server ?
Are you curl'ing to your own server?
yes, I added my openssl version into the original post
Can you open the site in your webbrowser?
Yes, in Chrome it seems that TLS 1.2 is used
|

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.