Php IPN处理接收到的数据不工作

Php IPN处理接收到的数据不工作,php,paypal,paypal-ipn,Php,Paypal,Paypal Ipn,在我的网站上,我的IPN有一个小问题。 我处理我的IPN文件,并添加了一些行来处理从IPN模拟器接收到的数据,如付款人电子邮件和产品编号 在未经验证的情况下,我有一个功能,可以向我的客户发送带有令牌代码的电子邮件。这个有效 在Verified上,我有一个功能,在我的服务器上创建一个文件后向我的客户发送一封带有令牌代码的电子邮件,并进行一些比较,如if(received_prod_number==“12345”)创建一个文件并发送电子邮件。 问题是,如果它不介入的话 if ((strist

在我的网站上,我的IPN有一个小问题。 我处理我的IPN文件,并添加了一些行来处理从IPN模拟器接收到的数据,如付款人电子邮件和产品编号

在未经验证的情况下,我有一个功能,可以向我的客户发送带有令牌代码的电子邮件。这个有效

在Verified上,我有一个功能,在我的服务器上创建一个文件后向我的客户发送一封带有令牌代码的电子邮件,并进行一些比较,如if(received_prod_number==“12345”)创建一个文件并发送电子邮件。 问题是,如果它不介入的话

    if ((stristr ($res, "VERIFIED") == 0) && ($_POST['payment_status'] == 'Completed')){
// The IPN is verified, process it:
// check whether the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process the notification

// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
if($item_number=='com.itbstudios.pilotlogbook.apk')
{
  $pagename = ".{$payer_email}";
  $newFileName = './sync/Pilot-Logbook/.License/'.$pagename.".i";
  $newFileContent = "";
  file_put_contents($newFileName,$newFileContent);

  generate_encrypt_insert($payer_email,$item_number);


}







// IPN message values depend upon the type of notification sent.
// To loop through the &_POST array and print the NV pairs to the screen:
foreach($_POST as $key => $value) {
echo $key." = ". $value."<br>";

}

} else if (strcmp ($res, "INVALID") == 0) {
// IPN invalid, log for manual investigation
echo "The response from IPN was: <b>" .$res ."</b>";


generate_encrypt_insert('email@email.email','com.itbstudios.pilotlogbook.apk');

}
if((stristr($res,“VERIFIED”)==0)和&($\u POST['payment\u status']=='Completed')){
//IPN已验证,处理它:
//检查付款状态是否已完成
//检查txn_id之前是否未被处理
//检查收件人的电子邮件是否是您的主要PayPal电子邮件
//检查付款金额/付款货币是否正确
//处理通知
//将已发布的变量分配给局部变量
$item\u name=$\u POST['item\u name'];
$item\u number=$\u POST['item\u number'];
$payment\u status=$\u POST['payment\u status'];
$payment\u amount=$\u POST['mc\u gross'];
$payment\u currency=$\u POST['mc\u currency'];
$txn_id=$_POST['txn_id'];
$receiver\u email=$\u POST['receiver\u email'];
$payer_email=$_POST['payer_email'];
如果($item_number=='com.itbstudios.pilotlogbook.apk')
{
$pagename=“.{$payer_email}”;
$newFileName='./sync/Pilot Logbook/.License/'.$pagename..i”;
$newFileContent=“”;
文件内容($newFileName,$newFileContent);
生成加密插入($payer\u email,$item\u number);
}
//IPN消息值取决于发送的通知类型。
//要循环通过&_POST阵列并将NV对打印到屏幕上,请执行以下操作:
foreach($\发布为$key=>$value){
echo$key.“=”$value.“
”; } }else if(strcmp($res,“无效”)==0){ //IPN无效,用于手动调查的日志 echo“IPN的回复是:“.$res.”; 生成\u加密\u插入('email@email.email","com.itbstudios.pilotlogbook.apk",; }
您是否检查了您在IPN数据中获得的$\u POST['item\u number']的实际值?我的猜测是它不等于您在那里比较的值。@AndrewAngell它看起来像'code'$\u POST['item\u number']'code'是空的,但如果我加上'1',那么'code'$\u POST['item\u number1']'code'就是正确的值。我必须用实际付款来测试它,看看它是有1还是没有:)订单上的每个项目都会有项目编号1、项目编号2等,但订单上的第一个项目也应该有一个常规项目编号。