连接到paypal剂量的工作

时间:2016-02-10 17:21:42

标签: php curl paypal paypal-pdt

我尝试检查付款usind pdt 这是我的代码:

$pp_hostname = "www.paypal.com"; 
$req = 'cmd=_notify-synch';
$tx_token = $_GET['tx'];
$req .= "&tx=$tx_token&at=$asimon";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://$pp_hostname/cgi-bin/webscr");
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_HTTPHEADER, array("Host: $pp_hostname"));
$res = curl_exec($ch);
curl_close($ch);
if(!$res){
echo 'Error';
}

我总是得到错误;
我付款但连接不起作用 有什么问题?

1 个答案:

答案 0 :(得分:1)

您的服务器可能没有PayPal的新证书链。测试一下,如果有效,请更新您的证书:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

同时删除它:

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: $pp_hostname"));

curl已发送该标题