Php paypal IPN已成功发送
我已经使用代码建立了一个简单的IPN 但是当我运行以下命令时Php paypal IPN已成功发送,php,paypal,paypal-ipn,Php,Paypal,Paypal Ipn,我已经使用代码建立了一个简单的IPN 但是当我运行以下命令时 <?php include('ipnlistener.php'); $listener = new IpnListener(); $listener->use_sandbox = true; try { $verified = $listener->processIpn(); } catch (Exception $e) { // fatal
<?php
include('ipnlistener.php');
$listener = new IpnListener();
$listener->use_sandbox = true;
try {
$verified = $listener->processIpn();
} catch (Exception $e) {
// fatal error trying to process IPN.
exit(0);
}
if ($verified) {
if ($verified) {
mail('myemail@gmail.com', 'Verified IPN', $listener->getTextReport());
}
else {
/*
An Invalid IPN *may* be caused by a fraudulent transaction attempt. It's
a good idea to have a developer or sys admin manually investigate any
invalid IPN.
*/
mail('myemail@gmail.com', 'Invalid IPN', $listener->getTextReport());
}
}
?>
您需要进行详细调试,一种方法是在每行之后将日志写入文件,然后检查是哪个步骤导致了问题,您还可以直接浏览IPN URL并检查无效IPN的电子邮件是否为wokring。邮件服务器配置可能有问题。我有其他邮件脚本触发ok,我如何记录服务器正在接收的内容?@Russellharlower您将通过HTTP POST方法接收所有数据,您可以记录POST数组。为什么有if($verified)
两次?根据代码中的逻辑,内部else
块永远不会发生,因此当IPN无法验证时,您永远不会收到电子邮件。