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

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.

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

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大