我觉得这里有点超出我的深度。自从几天前对 PayPal 进行大修以来,我一直遇到沙盒 IPN 模拟器的问题。
基本上 curl 结果通常显示 VERIFIED 或 INVALID,现在似乎返回一个空字符串。
这个完全相同的代码在实时模式下工作,但现在在沙箱中不适合我:
$post_fields ='cmd=_notify-validate';
foreach($_POST as $key => $val)
{
$post_fields .= "&$key=".urlencode($val);
}
$ch = curl_init();
// $url is https://www.sandbox.paypal.com/cgi-bin/webscr
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$ch_result = curl_exec($ch);
curl_close($ch);
我环顾四周并尝试了各种建议,例如使用 HTTP 1.1 版和添加curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
,但似乎没有任何效果。
我得到了所有其他的帖子字段,这只是 $ch_result。很困惑,有没有其他人遇到过这个问题,他们能够解决它吗?