This problem bugs me for a couple of minutes. I was trying to use curl on sending POST request to a specific website with SSL but it returns cURL error 35. So I tried to ask my friend google for a solution. A couple of stackoverflow links appeared and most of them told me to try adding this to my PHP code.
But that didn’t solve my problem. So I dig in deeper. I tried cURL on terminal.
curl -v https://test-site.com
And it returns this:
* About to connect() to test-site.com port 443 (#0) * Trying 0.0.0.0... connected * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSLv3, TLS handshake, Client hello (1): * Unknown SSL protocol error in connection to test-site.com:443 * Closing connection #0 curl: (35) Unknown SSL protocol error in connection to test-site.com:443
So I tried installing ca-certificates. By the way I’m using CentOS 6.5
yum install ca-certificates
Still didn’t solve my problem. So I have no other option but to try upgrading my curl by issuing this commands
rpm -Uvh http://nervion.us.es/city-fan/yum-repo/rhel6/x86_64/city-fan.org-release-1-13.rhel6.noarch.rpm yum clean all yum install libcurl
and then restart my apache.
service httpd restart
and suddenly it worked! 😀
So if you ever encounter this type of error and adding curl_setopt($ch, CURLOPT_SSLVERSION,3); didn’t solve your problem, try upgrading your curl 😀
By the way, remove curl_setopt($ch, CURLOPT_SSLVERSION,3); if you have upgraded your curl already before testing again. 😀
The latest libcurl requires libnghttp2. So if in case you encounter a dependency error while installing libcurl, follow this instruction to install libnghttp2.
First install epel repo
cd /tmp wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm
Then install libnghttp2.
yum install nghttp2
Then after it’s done, you should be able to install the latest libcurl with no problem.