相关文章推荐
刚失恋的水煮肉  ·  curl ...·  1 月前    · 
魁梧的羊肉串  ·  【Azure ...·  22 小时前    · 
强悍的梨子  ·  python ...·  22 小时前    · 
性感的鸵鸟  ·  curl命令 CURL命令 测试 ...·  22 小时前    · 
卖萌的登山鞋  ·  Android getevent - CSDN文库·  5 月前    · 
坐怀不乱的罐头  ·  Visual Studio 17.7 ...·  1 年前    · 
刚毅的火车  ·  TypeScript ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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.

You don't. You update whatever is trying to use SSLv3 because it is hilariously and dangerously out of date. For reference, SSLv3 support was removed from Firefox in November 2014 because of gigantic, unpatchable security holes. – Sammitch Feb 19, 2021 at 1:28

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

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.