PHP 35:错误:14094410:SSL例程:SSL3_READ_BYTES:sslv3警报握手失败

时间:2022-10-19 18:04:45

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 line, but unfortunately i do not understand them :/ and I do not know how to move them to PHP cURl flags.

我在PHP中使用cURL扩展。我为curl命令行找到了一些解决方案,但不幸的是我不理解它们:/而且我不知道如何将它们移动到PHP curl标志。

cURL conf:

旋度配置:

$curl=curl_init();
curl_setopt($curl, CURLOPT_URL, "https://pln.bitcurex.com/data/ticker.json");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_USERAGENT, $this->useragent);
curl_setopt($curl, CURLOPT_VERBOSE, 0);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers);

if(substr($url, 0, 5)=='https') curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);

if($this->ciastko)
{
    curl_setopt($curl, CURLOPT_COOKIEJAR, $this->ciastko);
    curl_setopt($curl, CURLOPT_COOKIEFILE, $this->ciastko);
}

if($this->post)
{
    if( is_array($this->post) && count($this->post) > 0 )
    {
        $postdata = http_build_query($this->post,'','&');
    }
    elseif( is_string($this->post) )
    {
        $postdata = $this->post;
    }
    else $postdata = '';

    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
}

$wynik=curl_exec($curl);

error:

错误:

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

35:错误:14094410:SSL例程:SSL3_READ_BYTES:sslv3警报握手失败

any ideas how to fix this?

有办法解决这个问题吗?

3 个解决方案

#1


10  

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');

#2


10  

I just change from

我只是从

curl_setopt($curl, CURLOPT_SSLVERSION, 3);

curl_setopt(美元curl CURLOPT_SSLVERSION 3);

to

curl_setopt($curl, CURLOPT_SSLVERSION, 4);

curl_setopt(美元curl CURLOPT_SSLVERSION 4);

#3


0  

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;
 } 

#1


10  

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');

#2


10  

I just change from

我只是从

curl_setopt($curl, CURLOPT_SSLVERSION, 3);

curl_setopt(美元curl CURLOPT_SSLVERSION 3);

to

curl_setopt($curl, CURLOPT_SSLVERSION, 4);

curl_setopt(美元curl CURLOPT_SSLVERSION 4);

#3


0  

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;
 }