我想实现PayPal IPN,但它永远不会到达我设置的网址。我写了一个脚本记录访问这个网址,我得到的只是我的访问。PayPal IPN无法验证
Paypal发送通知需要多长时间?
编辑
互穿网络突然开始来了,但我现在无法确认...以下是代码:
$url = 'https://www.paypal.com/cgi-bin/webscr';
$postdata = '';
foreach ($_POST as $i => $v) {
$postdata .= $i . '=' . urlencode($v) . '&';
}
$postdata .= 'cmd=_notify-validate';
$web = parse_url($url);
if ($web['scheme'] == 'https') {
$web['port'] = 443;
$ssl = 'ssl://';
} else {
$web['port'] = 80;
$ssl = '';
}
$fp = @fsockopen($ssl . $web['host'], $web['port'], $errnum, $errstr, 30);
if (!$fp) {
echo $errnum . ': ' . $errstr;
} else {
fputs($fp, "POST " . $web['path'] . " HTTP/1.1\r\n");
fputs($fp, "Host: " . $web['host'] . "\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($postdata) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $postdata . "\r\n\r\n");
while (!feof($fp)) {
$info[] = @fgets($fp, 1024);
}
fclose($fp);
$info = implode(',', $info);
if (eregi('VERIFIED', $info)) {
} else {
}
}
您是否在控制面板中启用了IPN? – PiZzL3 2011-04-17 17:10:46
你在用什么语言?另外,你应该发布有问题的代码。 – 2011-04-17 17:11:08
是的,网址是正确的... – chchrist 2011-04-17 17:11:23