【问题标题】:Connect to paypal dose'nt work连接到贝宝不起作用
【发布时间】:2023-03-15 12:51:01
【问题描述】:

我尝试使用 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';
}

而且我总是出错;
我付款了,但连接不起作用 有什么问题?

【问题讨论】:

标签: php curl paypal paypal-pdt


【解决方案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 已经发送了该标头

【讨论】:

  • @Harmanmet 嗨!如果可行,请将我的帖子标记为答案 =D
猜你喜欢
  • 2015-12-12
  • 1970-01-01
  • 2012-07-28
  • 2021-07-18
  • 2013-09-28
  • 2013-08-10
  • 2016-01-13
  • 2012-02-09
  • 2017-08-21
相关资源
最近更新 更多