Php 贝宝IPN不再工作了

Php 贝宝IPN不再工作了,php,post,paypal,paypal-ipn,Php,Post,Paypal,Paypal Ipn,从昨天开始,PayPal IPN运行良好,但今天我无法收到任何IPN。我检查了MySQL,检查了IPN地址,一切都很好。我在想PayPal在他们的IPN服务器上做了一些改变,电话里的那个女人告诉我没有。有点奇怪 那么有人能检查一下ipn.php和add.php吗 添加php <? define('BASEPATH', true); require_once("../../config.php"); if(!$is_online){ redirect('../../../index.

从昨天开始,PayPal IPN运行良好,但今天我无法收到任何IPN。我检查了MySQL,检查了IPN地址,一切都很好。我在想PayPal在他们的IPN服务器上做了一些改变,电话里的那个女人告诉我没有。有点奇怪

那么有人能检查一下ipn.php和add.php吗

添加php

<?
define('BASEPATH', true);
require_once("../../config.php");
if(!$is_online){
    redirect('../../../index.php');
    exit;
}

$s_host = parse_url($site['site_url']);

if($_GET['cash'] != '' && is_numeric($_GET['cash'])){
    $cash = ($_GET['cash'] < 1 ? 1 : $_GET['cash']);
    $cash = number_format($cash, 2, '.', '');
}else{
    redirect('../../../index.php');
    exit;
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Redirecting...</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<style>body{background: #fff;font: 13px Trebuchet MS, Arial, Helvetica, Sans-Serif;color: #333;line-height: 160%;margin: 0;padding: 0;text-align: center;}h1{font-size: 200%;font-weight: normal}.centerdiv{position: absolute;top: 50%; left: 50%; width: 340px; height: 200px;margin-top: -100px; margin-left: -160px;}</style>
<script type="text/javascript">
    setTimeout('document.paypalform.submit()',1000);
</script>
</head>
<body>
<div class="centerdiv"><h1>Connecting to Paypal <img src="<?=$site['site_url']?>/img/go_loader.gif" /></h1></div>
<form name="paypalform" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?=$site['paypal']?>">
<input type="hidden" name="item_name" value="<?='Add Funds - '.$data['login'].' - '.$s_host['host']?>">
<input type="hidden" name="custom" value="<?=($data['id'].'|'.$cash.'|'.VisitorIP())?>">
<input type="hidden" name="amount" value="<?=$cash?>">
<input type="hidden" name="currency_code" value="<?=($site['currency_code'] == '' ? 'USD' : $site['currency_code'])?>">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="<?=$site['site_url']?>/bank.php?success">
<input type="hidden" name="cancel_return" value="<?=$site['site_url']?>/bank.php?cancel">
<input type="hidden" name="notify_url" value="<?=$site['site_url']?>/system/payments/paypal/ipn.php">
</form>
</body>
</html>

重定向。。。
正文{背景:#fff;字体:13px投石机MS,Arial,Helvetica,无衬线;颜色:#333;线条高度:160%;边距:0;填充:0;文本对齐:中心;}h1{字体大小:200%;字体重量:正常}。中心div{位置:绝对;顶部:50%;左侧:50%;宽度:340px;高度:200px;顶部边距:100px;左侧:160px;}
setTimeout('document.paypalform.submit()',1000);
连接到Paypal/img/go_loader.gif“/>

我也遇到了同样的问题。他们开始在响应末尾添加“\r\n”,因此我将“已验证”与“已验证”\r\n进行比较,结果失败。您可以执行以下操作:

trim($res)

在进行验证测试之前,或者您可以使用
strpos
而不是
strcmp

if(strpos($res,“VERIFIED”)==0
(需要==,而不是==)

最后,他们还要求之前的所有客户开始添加连接头:


$header.=“连接:关闭\r\n";

要解决此问题,您需要在PayPal业务帐户中编辑即时付款通知设置。这个分步说明帮助很多人启用IPN-

这个问题似乎离题了,因为它是关于PayPal服务而不是编程的。@chrylis完全不同意-我们有PayPal和PayPal IPN标签的原因是为了解决与此相关的编程问题。我被这一变化弄糊涂了,这个答案救了我。你救了我一天:)谢谢——一年多以后,这也为我救了一天
<?php
define('BASEPATH', true);
require("../../config.php");

$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\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

// 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'];
$custom = $_POST['custom'];

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
    $res = fgets ($fp, 1024);
    if (strcmp ($res, "VERIFIED") == 0) {
        $get_data = explode('|', $custom); 

        if($site['paypal_auto'] == 1){
            if($payment_status == 'Completed'){
                $user = $db->QueryFetchArray("SELECT id,login FROM `users` WHERE `id`='".$get_data[0]."'");
                $check = $db->QueryGetNumRows("SELECT id FROM `transactions` WHERE `gateway`='paypal' AND `trans_id`='".$txn_id."'");
                if($check == 0){
                    $db->Query("INSERT INTO `transactions` (user, user_id, money, gateway, date, user_ip, trans_id) VALUES('".$user['login']."','".$user['id']."', '".$payment_amount."', 'paypal', NOW(), '".$get_data[2]."', '".$txn_id."')");
                    if($user['id'] > 0){
                        $db->Query("UPDATE `users` SET `account_balance`=`account_balance`+'".$payment_amount."' WHERE `id`='".$user['id']."'");            
                    }
                }
            }
        }else{
            $user = $db->QueryFetchArray("SELECT id,login FROM `users` WHERE `id`='".$get_data[0]."'");
            $check = $db->QueryGetNumRows("SELECT id FROM `transactions` WHERE `gateway`='paypal' AND `trans_id`='".$txn_id."'");
            if($check == 0){
                $db->Query("INSERT INTO `transactions` (user, user_id, money, gateway, date, paid, user_ip, trans_id) VALUES('".$user['login']."','".$user['id']."', '".$payment_amount."', 'paypal', NOW(), '0', '".$get_data[2]."', '".$txn_id."')");
            }
        }
    }
}
fclose ($fp);
}
?>