问题是 Paypal 根本没有对此请求作出响应。下面是我使用的示例代码
我使用 PHP 5.3 版
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
//post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Host: www.paypal.com\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n";
$header .= "Connection: close\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
//$res = trim($res); //NEW & IMPORTANT
if (strcmp (trim($res), 'VERIFIED') == 0){
}
else if (strcmp (trim($res), "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
(我仍然无法从 Paypal 获得“已验证”回复)请提供任何建议??