我得到的 503 响应是“服务不可用”——与这个不完全相同。付款状态为“完成”
我打电话给 PayPal,他们说这是他们试图解决的问题。他们建议我重试通话。
这是我所做的,它似乎正在工作。
//$req = set of key/value pairs sent by paypal
// Step 2: POST IPN data back to PayPal to validate
$ir = 0;
while($ir<3&&($ir==0||strpos($res,'Service Unavailable')>0)) {
if($ir!=0) { //wait and try again after 1st try
//log the problem somehow
$sam = 1;
sleep(2);
unset($res);
}
//setup the call
$ch = curl_init('https://www.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'));
if( !($res = curl_exec($ch)) ) {
//log the problem somehow
curl_close($ch);
exit;
}
curl_close($ch);
$ir += 1;
}