如何让 php 的 curl 接受 SSLv3?
How do I make php's curl accept SSLv3?
我有以下代码:
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");
}
}
当我有 curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'all');
时,它 returns 错误:
Could not download file. cURL Error: [35] - error:1408F10B:SSL routines:ssl3_get_record:wrong version number
当我有 curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'3');
时,我得到一个不同的错误:
Could not download file. cURL Error: [4] - OpenSSL was built without SSLv3 support
我的 OpenSSL 版本似乎不支持 SSLv3,我不知道如何解决这个问题。
我尝试了不同的方法来更改我的 openssl 版本,但其中 none 有效。
不再支持请参阅下面的 curl 文档以了解受支持的 CURLOPT_SSLVERSION 值 link。
自 7.18.1 起默认禁用 SSLv2。其他 SSL 版本的可用性可能会有所不同,具体取决于构建使用的后端 libcurl。
自 7.39.0 起默认禁用 SSLv3。
我有以下代码:
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");
}
}
当我有 curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'all');
时,它 returns 错误:
Could not download file. cURL Error: [35] - error:1408F10B:SSL routines:ssl3_get_record:wrong version number
当我有 curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'3');
时,我得到一个不同的错误:
Could not download file. cURL Error: [4] - OpenSSL was built without SSLv3 support
我的 OpenSSL 版本似乎不支持 SSLv3,我不知道如何解决这个问题。 我尝试了不同的方法来更改我的 openssl 版本,但其中 none 有效。
不再支持请参阅下面的 curl 文档以了解受支持的 CURLOPT_SSLVERSION 值 link。
自 7.18.1 起默认禁用 SSLv2。其他 SSL 版本的可用性可能会有所不同,具体取决于构建使用的后端 libcurl。
自 7.39.0 起默认禁用 SSLv3。