dp7311 2014-11-20 07:58
浏览 257
已采纳

CURL获取错误:14094410:SSL

This is my code. Am trying get information from a server.

But I got stuck in the middle. Please help me.

Am getting error such as

[errors] => Array ( [0] => error:14094410:SSL 
                 routines:SSL3_READ_BYTES:sslv3 alert handshake failure ) ) 

Below is the code that I have written please check and help me. Will appreciate any help.

public function get_quotes(){
     $reservation_obj->source = "test";
     $reservation_obj->location_code = "test";
     $reservation_obj->start_date = "2010-06-01 19:00";
     $reservation_obj->end_date = "2010-06-04 13:50";


     $reservation_obj->action = "get_quotes";
     $json = json_encode($reservation_obj);
     $curl_opts = array(
     CURLOPT_HEADER => false,
     CURLOPT_HTTPHEADER => array('Content-Type: text/json', 'Content-length: '.strlen($json)),
     CURLOPT_POST => true,
     CURLOPT_POSTFIELDS => $json,
    CURLOPT_RETURNTRANSFER => true,
     CURLOPT_URL => "https://myserver/test.php",
     CURLOPT_VERBOSE => false,
     CURLOPT_SSLCERT => getcwd()."/newfile.crt.pem",
     CURLOPT_SSLCERTTYPE => "PEM",
     CURLOPT_SSLKEY=> getcwd()."/newfile.key.pem",
     CURLOPT_SSLKEYTYPE => "PEM",
     CURLOPT_SSL_VERIFYHOST => false,
     CURLOPT_SSL_VERIFYPEER => false,
     CURLOPT_SSLVERSION => 3
     );

     $curl = curl_init();
     curl_setopt_array($curl, $curl_opts);
     if(!$response = curl_exec($curl)){
     $response->errors[] = curl_error($curl);
     }
     curl_close($curl);

     if(count($response ->errors)){
      print_r($response);
     }else{

     print_r($response);

     }

     }
  • 写回答

1条回答 默认 最新

  • douye9822 2014-11-20 08:40
    关注

    comment out the CURLOPT_SSLVERSION => 3 line and try again.

    They say the SSL v3 is vulnerable (idk much about that, sorry), so many of the servers do not allow it using the v3.

    Here is an article if you are interested. https://access.redhat.com/articles/1232123

    Please let me know the result after you try it. thanks.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?