PHP 35: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

后端 未结 3 1011
死守一世寂寞
死守一世寂寞 2020-12-18 07:05

cURL stopped working. I started to get this error (it used work fine till few hours ago).

I am using cURL extension for PHP. I found some solution for curl command l

相关标签:
3条回答
  • 2020-12-18 07:42

    I know it's a bit outdated problem, but I've got a solution for others:

    curl_setopt($ch, CURLOPT_SSLVERSION, 3);
    curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');
    
    0 讨论(0)
  • 2020-12-18 07:57

    Input values :

    $params = Array
        (
            "username" => "XXXXXXXXXX",
            "password" => "XXXXXX"
        );
    
    $path ='https://www.XXXXXXXX.com/xx/xxx/format/json/';
    

    Function:

    function curlpost($parameters, $path){
         $apiUrl = $path;
         $curl_handle = curl_init();
         curl_setopt($curl_handle, CURLOPT_URL, $apiUrl);
         curl_setopt($curl_handle, CURLOPT_BUFFERSIZE, 1024);
         curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
         curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
         curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, TRUE);
         curl_setopt($curl_handle, CURLOPT_POST, TRUE);
         curl_setopt($curl_handle, CURLOPT_PROXY, '');
         curl_setopt($curl_handle, CURLOPT_SSLVERSION, 4);
         curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $parameters);
         $response = curl_exec($curl_handle);
    
         $content = curl_exec( $curl_handle );
         $err     = curl_errno( $curl_handle );
         $errmsg  = curl_error( $curl_handle );
         $header  = curl_getinfo( $curl_handle );
         curl_close( $curl_handle );
    
         $header['errno']   = $err;
         $header['errmsg']  = $errmsg;
         $header['content'] = $content;
        curl_close($curl_handle);
         return $header;
     } 
    
    0 讨论(0)
  • 2020-12-18 07:59

    I just change from

    curl_setopt($curl, CURLOPT_SSLVERSION, 3);

    to

    curl_setopt($curl, CURLOPT_SSLVERSION, 4);

    0 讨论(0)
提交回复
热议问题