IPN听众突然停止工作

时间:2015-03-24 12:42:48

标签: php curl paypal ssl-certificate paypal-ipn

我的paypal IPN听众现在已经工作了一年多,今天它突然停止了处理错误

cURL error: [60] SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

我的卷曲设置是

protected function curlPost($encoded_data) {
    if ($this->use_ssl) {
        $uri = 'https://'.$this->getPaypalHost().'/cgi-bin/webscr';
        $this->post_uri = $uri;
    } else {
        $uri = 'http://'.$this->getPaypalHost().'/cgi-bin/webscr';
        $this->post_uri = $uri;
    }

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_CAINFO, 
                dirname(__FILE__)."/cert/api_cert_chain.crt");
    curl_setopt($ch, CURLOPT_URL, $uri);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded_data);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $this->follow_location);
    curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, true);


    $this->response = curl_exec($ch);
    $this->response_status = strval(curl_getinfo($ch, CURLINFO_HTTP_CODE));

    if ($this->response === false || $this->response_status == '0') {
        $errno = curl_errno($ch);
        $errstr = curl_error($ch);
        throw new Exception("cURL error: [$errno] $errstr");
    }
}

我尝试使用http://curl.haxx.se/ca/cacert.pem中的最新证书api_cert_chain.crt作为与此相关的许多答案中的建议,但它没有改变任何内容。

这可能是什么原因?

1 个答案:

答案 0 :(得分:1)

添加curl_setopt($ch, CURLOPT_SSLVERSION, 4);解决了问题。