2014-05-09 5 views
5

cURL funktioniert nicht mehr. Ich fing an, diesen Fehler zu bekommen (es funktionierte gut bis vor wenigen Stunden).PHP 35: Fehler: 14094410: SSL-Routinen: SSL3_READ_BYTES: sslv3 Alarm Handshake Fehler

Ich benutze cURL Erweiterung für PHP. Ich habe eine Lösung für die curl-Befehlszeile gefunden, aber leider verstehe ich sie nicht:/und ich weiß nicht, wie ich sie zu PHP cURl-Flags verschieben soll.

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

Fehler:

35: Fehler: 14094410: SSL-Routinen: SSL3_READ_BYTES: SSLv3 Alarm Handshake-Fehler

irgendwelche Ideen, wie dieses Problem beheben?

+0

gleiche Problem https://github.com/coreos/etcd/issues/209 –

Antwort

10

Ich weiß, es ist ein bisschen veraltet Problem, aber ich habe eine Lösung für andere bekam:

curl_setopt($ch, CURLOPT_SSLVERSION, 3); 
curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'SSLv3'); 
+1

Können Sie mir bitte erklären, was diese Einstellung zu tun und wie wird es im Zusammenhang Fehlermeldung kräuseln fragte in der Frage? – hakre

+0

Dies funktioniert nicht, und ich habe das gleiche Problem ... Dies scheint auf älteren Centos 5-basierten Servern mit älteren OpenSSL 0.9.8 – Carmageddon

+3

passieren Aufgrund der POODLE-Sicherheitslücke viele Standorte jetzt deaktivieren SSL 3.0. Sie sollten zu TLS wechseln, was wie folgt aussehen würde: curl_setopt ($ ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1) –

10

Ich wechsle gerade von

curl_setopt($curl, CURLOPT_SSLVERSION, 3);

zu

curl_setopt($curl, CURLOPT_SSLVERSION, 4);

0

Eingangs Werte:

$params = Array 
    (
     "username" => "XXXXXXXXXX", 
     "password" => "XXXXXX" 
    ); 

$path ='https://www.XXXXXXXX.com/xx/xxx/format/json/'; 

Funktion:

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