I used the following block of code to collect data from an 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 may be due to an older version of OpenSSL, but since the website is shared, server-side settings cannot be changed at this time. All I can do is change the cURL options.
I checked here https://www.ssllabs.com/ssltest/analyze.html to see the available protocols for this server, the detected SSL3 and SSL2 are not available, but TLS 1.2, TLS 1.1 and TLS 1.0 are available. Searching through Google, I found that itβs better not to specify the SSL version that actually automatically negotiates the best level to use. Although, I tried setting the TLS version to CURLOPT_SSLVERSION (as follows), but the same error occurs.
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
I tried a lot the past few days, but all attempts went in vain.
I tried to explain everything I did, but someone will ask if more information is needed. Any help would be greatly appreciated.
thanks a lot