Php paypal IPN突然失败(无HTTP响应)

Php paypal IPN突然失败(无HTTP响应),php,paypal,paypal-ipn,paypal-sandbox,Php,Paypal,Paypal Ipn,Paypal Sandbox,我的paypal IPN脚本突然不起作用了。 在paypal IPN历史记录中,IPN现在出现故障,HTTP响应代码保持为空。是什么导致了这种情况,以及如何修复? 我没有更改任何代码,它只是停止工作 以下是我的php代码: <?php //Change these with your information $paypalmode = ''; //Sandbox for testing or empty '' $dbusername = 'xxx'; //db usernam

我的paypal IPN脚本突然不起作用了。 在paypal IPN历史记录中,IPN现在出现故障,HTTP响应代码保持为空。是什么导致了这种情况,以及如何修复? 我没有更改任何代码,它只是停止工作

以下是我的php代码:

<?php
   //Change these with your information
$paypalmode = ''; //Sandbox for testing or empty ''
$dbusername     = 'xxx'; //db username
$dbpassword     = 'xxx'; //db password
$dbhost     = 'xxx.com'; //db host
$dbname     = 'xxx'; //db name

if($_POST)
{
    if($paypalmode=='sandbox')
    {
        $paypalmode     =   '.sandbox';
    }
    $req = 'cmd=' . urlencode('_notify-validate');
    foreach ($_POST as $key => $value) {
        $value = urlencode(stripslashes($value));
        $req .= "&$key=$value";
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://www'.$paypalmode.'.paypal.com/cgi-bin/webscr');
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: www'.$paypalmode.'.sandbox.paypal.com'));
    $res = curl_exec($ch);
    curl_close($ch);

    if (strcmp ($res, "VERIFIED") == 0)
    {
        $transaction_id = $_POST['txn_id'];
        $ebaytxnid = $_POST['ebay_txn_id1'];
        $payerid = $_POST['payer_id'];
        $firstname = $_POST['first_name'];
        $lastname = $_POST['last_name'];
        $ebayname = $_POST['auction_buyer_id'];
        $email = $_POST['payer_email'];
        $shippingname = $_POST['address_name'];
        $shippingstreet = $_POST['address_street'];
        $shippingcity = $_POST['address_city'];
        $shippingstate = $_POST['address_state'];
        $shippingzip = $_POST['address_zip'];
        $shippingcountry = $_POST['address_country'];
        $shippingcountrycode = $_POST['address_country_code'];
        $currency = $_POST['mc_currency'];
        $paymentfee = $_POST['payment_fee'];
        $total = $_POST['payment_gross'];
        $mcfee = $_POST['mc_fee'];
        $mcgross = $_POST['mc_gross'];
        $ebayitemno = $_POST['item_number'];
        $ebayitemname = $_POST['item_name'];
        $quantity = $_POST['quantity1'];
        $paymentdate = $_POST['payment_date'];
        $mdate= date('Y-m-d h:i:s',strtotime($paymentdate));
        $paymentstatus = $_POST['payment_status'];
        $payerstatus = $_POST['payer_status'];
        $paymenttype = $_POST['payment_type'];
        $addressstatus = $_POST['address_status'];
        $forauction = $_POST['for_auction'];
        $protectioneligibility = $_POST['protection_eligibility'];
        $otherstuff = json_encode($_POST);

        $conn = mysql_connect($dbhost,$dbusername,$dbpassword);
        if (!$conn)
        {
         die('Could not connect: ' . mysql_error());
        }

        mysql_select_db($dbname, $conn);

        // insert in our IPN record table
        $query = "INSERT INTO ibn_table
        (itransaction_id,iebaytxnid,ipayerid,ifirstname,ilastname,iebayname,iemail,ishippingname,ishippingstreet,ishippingcity,ishippingstate,ishippingzip,ishippingcountry,ishippingcountrycode,icurrency,ipaymentfee,itotal,imcfee,imcgross,iebayitemno,iebayitemname,iquantity,itransaction_date,ipaymentstatus,ipayerstatus,ipaymenttype,iaddressstatus,iforauction,iprotectioneligibility,ieverything_else)
        VALUES
        ('$transaction_id','$ebaytxnid','$payerid','$firstname','$lastname','$ebayname','$email','$shippingname','$shippingstreet','$shippingcity','$shippingstate','$shippingzip','$shippingcountry','$shippingcountrycode','$currency','$paymentfee','$total','$mcfee','$mcgross','$ebayitemno','$ebayitemname','$quantity','$mdate','$paymentstatus','$payerstatus','$paymenttype','$addressstatus','$forauction','$protectioneligibility','$otherstuff')";

        if(!mysql_query($query))
        {
            //mysql error..!
        }
        mysql_close($conn);

    }
}
?>
更新:
2017年3月15日上午11:47突然再次工作

我在Godaddy上的几个托管帐户也有问题。截至2017年3月13日上午10-12点左右,后端停止接收Paypal的IPN

对不起,如果事情没有道理,我是自学成才的白痴。 我尝试过的事情: 删除SSL证书 添加SSL证书 手动检查ipn url(工作) 白名单贝宝ip 将所有内容重命名为https 将所有内容重命名为http 四重检查以确保:IPN未禁用且IPN url正确

我发现了一些有趣的事情: 在所有托管帐户上,一切都正常工作了3年。 贝宝沙盒帐户发回IPN的完美的一切工作。 在事务中的IPN历史记录中,没有HTTP状态代码。 paypal根本无法访问IPN,在我的终端上没有错误或访问日志。 问题是多个托管帐户中只有一个在上个月发生了更改

让我知道你的想法和东西,希望贝宝能回应或修复它,因为所有的迹象都指向他们现在。厌倦了他们的复制粘贴响应。

更新: 2017年3月15日上午11:47突然再次工作

我在Godaddy上的几个托管帐户也有问题。截至2017年3月13日上午10-12点左右,后端停止接收Paypal的IPN

对不起,如果事情没有道理,我是自学成才的白痴。 我尝试过的事情: 删除SSL证书 添加SSL证书 手动检查ipn url(工作) 白名单贝宝ip 将所有内容重命名为https 将所有内容重命名为http 四重检查以确保:IPN未禁用且IPN url正确

我发现了一些有趣的事情: 在所有托管帐户上,一切都正常工作了3年。 贝宝沙盒帐户发回IPN的完美的一切工作。 在事务中的IPN历史记录中,没有HTTP状态代码。 paypal根本无法访问IPN,在我的终端上没有错误或访问日志。 问题是多个托管帐户中只有一个在上个月发生了更改


让我知道你的想法和东西,希望贝宝能回应或修复它,因为所有的迹象都指向他们现在。厌倦了他们的复制粘贴响应。

请阅读为什么你不应该再使用MySQL_*功能,也许有人更新了安全标准(特别是在使用支付选项时),导致旧代码容易被删除……我尝试搜索更新的安全标准,但没有找到任何东西。我一直遇到同样的问题@DannyNetten。即使使用一个简单的mysql DB脚本,它也不会工作。http头测试显示了正确的响应“http/1.1 200 OK”,但在paypal中它一直失败。我的主机是godaddy豪华linux主机,可能问题出在godaddy主机上?你的主机@Stoud是什么?请阅读为什么你不应该再使用MySQL_*功能,也许有人更新了安全标准(特别是在使用支付选项时),导致旧代码容易被删除……我尝试搜索更新的安全标准,但没有找到任何东西。我一直遇到同样的问题@DannyNetten。即使使用一个简单的mysql DB脚本,它也不会工作。http头测试显示了正确的响应“http/1.1 200 OK”,但在paypal中它一直失败。我的主机是godaddy豪华linux主机,可能问题出在godaddy主机上?你的主机@Stoud是什么?我已经联系过godaddy和paypal的技术支持。godaddy运行所有检查,并确认没有任何东西阻塞IPN或其服务器。Paypal正在进行调查,并且有更多关于相同问题的报告。到目前为止,一切都恢复了正常,我收到了paypal的回复:GoDaddy的客户面临着这个问题。他们这边是安全区。我们联系了GoDaddy,他们将我们的IP列入了白名单。我已经联系了GoDaddy和paypal的技术支持。godaddy运行所有检查,并确认没有任何东西阻塞IPN或其服务器。Paypal正在进行调查,并且有更多关于相同问题的报告。到目前为止,一切都恢复了正常,我收到了paypal的回复:GoDaddy的客户面临着这个问题。他们这边是安全区。我们联系了戈达迪,他们把我们的IP列入了白名单。