mpesa ssl握手失败的原因

时间:2016-08-12 13:38:07

标签: php ssl curl

与mpesa B2C集成。我正在尝试使用Curl

        $url = "https://196.201.214.136:18423/mminterface/request";




    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
    // curl_setopt($ch, CURLOPT_PORT, 18423);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $requestXml);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                           'Content-type: text/xml', 
                                           'Content-length: ' . strlen($requestXml)
                                         ));
    $output = curl_exec($ch);

    if(curl_errno($ch)){
        var_dump(curl_error($ch));
    } else{
        curl_close($ch);
    }

我收到错误

  

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

这是在将ssl版本从nss更改为openssl之后。 如何解决握手失败问题。

2 个答案:

答案 0 :(得分:1)

如果我没记错的话,MPESA会使用您需要与它们一起生成的一些公钥 - 私钥对。如果您没有正确设置,您的SSL请求将失败。你做过这个吗?

答案 1 :(得分:1)

Safaricom已发布M-Pesa API作为RESTful API,可通过developer portal 访问。您无需拥有Safaricom签署的SSL证书即可使用API​​。只要您的服务器具有公开签名的证书,Safaricom API网关就应该能够接收请求并将响应发送到您的服务器。

相关问题