我已经尝试了所有方法,但在尝试验证/确认时总是“被同行重置”..
这是我的提炼代码:
<?php
header('HTTP/1.1 200 OK');
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) // $_POST looks OK to me..
$req .= "&$key=".urlencode(stripslashes($value));
$fp = fsockopen("ssl://www.sandbox.paypal.com", 443, $errno, $errstr, 60); // true
$header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Conection: Close\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
fputs ($fp, $header . $req);
while (!feof($fp))
{
$res = fgets ($fp, 1024); // CONNECTION RESET BY PEER : (
if ($res === "VERIFIED") $response = "VERIFIED";
if ($res === "INVALID") $response = "INVALID";
}
fclose($fp);
为什么他们不跟我说话?!?
最佳答案
好的。找到了一些让我完成所有操作的示例代码:
https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.php
- 在收到“已验证”后,我可以使用 3 年前的代码了:)
关于php - Paypal 监听器 : Connection reset by peer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23288837/