2013-02-05 107 views
0

我已經使用的代碼https://github.com/Quixotix/PHP-PayPal-IPN貝寶IPN成功發送

但是建立一個簡單的IPN當我運行以下

<?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('[email protected]', '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('[email protected]', 'Invalid IPN', $listener->getTextReport()); 
    } 
} 
?> 

我沒有收到從我的服務器說它從得到的IPN任何郵件Paypal

+0

爲什麼你有'if($ verified)'兩次?通過你在代碼中的邏輯,那個內部的'else'塊永遠不會發生,因此當IPN無法驗證時,你永遠不會收到電子郵件。 –

回答

0

您需要詳細調試,一種方法是將每行後面的日誌寫入文件,然後檢查導致問題的步驟,並且您可以直接瀏覽IPN URL並檢查無效IPN的電子郵件是否正在運行或不。郵件服務器配置可能存在問題。

+0

我有其他郵件腳本正常發射,我怎樣才能記錄服務器正在接收什麼? – RussellHarrower

+0

@RussellHarrower您將通過HTTP POST方法接收所有數據,您可以記錄POST數組。 – Minesh