Reputation: 23
I have the following code:
curl_setopt($this->curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'all');
curl_setopt($this->curl_handle, CURLOPT_SSL_VERIFYPEER, false);
// set the file to be uploaded
if (!curl_setopt($this->curl_handle, CURLOPT_FILE, $fp_to_download)) {
throw new Exception("Could not download file $local_file");
}
// download file
try {
if (!curl_exec($this->curl_handle)) {
throw new Exception(sprintf('Could not download file. cURL Error: [%s] - %s', curl_errno($this->curl_handle), curl_error($this->curl_handle)));
}
} catch (Exception $e) {
$error_msg = $e->getMessage();
// Fallback to cUrl upload
if (strpos($error_msg, 'SSL23_GET_SERVER_HELLO')) {
return $this->curlProcessHandler('ftp://'.preg_replace('#/+#', '/', $this->server.':'.$this->port.'/'.$remote_file), $local_file);
} else {
throw new Exception("Could not download file $remote_file: $error_msg");
}
}
When I have curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'all');
, it returns the error:
Could not download file. cURL Error: [35] - error:1408F10B:SSL routines:ssl3_get_record:wrong version number
And when I have curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'3');
, I get a different error:
Could not download file. cURL Error: [4] - OpenSSL was built without SSLv3 support
It seems like my version of OpenSSL doesn't support SSLv3, and I don't know how to fix this. I've tried different methods of changing my openssl version, but none of them worked.
Upvotes: 2
Views: 3546
Reputation: 543
No longer supported see the curl docs for supported CURLOPT_SSLVERSION values link below.
SSLv2 is disabled by default since 7.18.1. Other SSL versions availability may vary depending on which backend libcurl has been built to use.
SSLv3 is disabled by default since 7.39.0.
https://curl.se/libcurl/c/CURLOPT_SSLVERSION.html
Upvotes: 2