PayPal IPN:无法获取本地颁发者证书 [英] PayPal IPN: unable to get local issuer certificate

查看:182
本文介绍了PayPal IPN:无法获取本地颁发者证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用curl验证PayPal IPN,但它会引发错误: SSL证书问题:无法获取本地颁发者证书。同样的代码正在开发服务器上,当我搬到客户端服务器它不工作。

I am using curl to verify the PayPal IPN but it throws error: SSL certificate problem: unable to get local issuer certificate. The same code is working on development server and when I moved to client server it is not working.

我需要购买SSL证书,以便通过PayPal快递付款检查或我的编码部分或任何设置的任何更改需要在server.Curl已在服务器上启用。

DO I need to purchase ssl certification in order to make payment via PayPal express checkout or any change in my coding part or any setting need to make on server.Curl is already enabled on server. Any help will be appreciated.

我的代码如下,它的缩小测试页:

My code below, and its a reduced test page for this:

$req = HAVING PARAMETERS FROM PAYPAL;

$ch = curl_init("https://www.sandbox.paypal.com/cgi-bin/webscr");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));

curl_exec($ch);
if(curl_errno($ch))
{
    echo 'Curl error: ' . curl_error($ch);
}


推荐答案

验证SSL连接,但您不告诉它要验证什么;

You're telling cURL to validate the SSL connection but you're not telling it what to validate against;

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);

请务必指向要信任的CA的最新列表, p>

Make sure you point to an up-to-date list of CA's to trust by adding:

curl_setopt($ch, CURLOPT_CAPATH, "./cacert.pem");

如果您自己没有最新的cacert列表,由cURL维护者提供的版本: cacert.pem

If you don't have an up-to-date cacert list yourself, I'd recommend downloading the one supplied by the cURL maintainer: cacert.pem.

这篇关于PayPal IPN:无法获取本地颁发者证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆