问题
I have been using the following code block to collect data from a HTTPS website using cURL.
$q = 'https://www.example.org/'; // for example
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $q);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$json = curl_exec($ch);
cURL shows the following error
error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 unrecognized name
This might be related to older OpenSSL version, but as the website is in a Shared hosting, server side settings cannot be changed at the moment. All I can do is to change cURL parameters.
I have checked here https://www.ssllabs.com/ssltest/analyze.html to see the available protocols for that server, found SSL3 and SSL2 is not available, but TLS 1.2, TLS 1.1 and TLS 1.0 are available. Searching over Google, I found its best not specifying SSL version which actually auto-negotiate the best level to use. Although, I tried with setting TLS version in CURLOPT_SSLVERSION (as follows), but same error occurs.
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
I have been trying a lot for last few days, but all attempts went in vain.
I have tried to explain all the things I did, but anyone please ask if more info needed. Any help would be greatly appreciated.
Thanks a lot
回答1:
This might be cURL #1037 Bug http://sourceforge.net/p/curl/bugs/1037/
It seems to happen when you connect with an outdated openssl 0.9.8 cURL against some server with openssl 1.0.x and use SNI.
来源:https://stackoverflow.com/questions/29808030/curl-error-35-error14077458ssl-routinesssl23-get-server-hellotlsv1-unreco