1

コードはチェック番号 3 まで機能し、それらをデータベースにインポートすると、空白の行が表示されるか、何も表示されないことがあります。私が使うとき

if ($_SERVER['REQUEST_METHOD'] != "POST") die ("ポスト変数なし");

上部のコードで、「投稿変数がありません」と表示されますが、投稿変数を使用して何か問題があるかどうかを確認できます。IPN から返された item 変数が表示されます。これは使用できるためですが、データベースにインポートしても表示されません。

それらをデータベースに追加できないのはなぜですか?

私はこのIPNに1週間取り組んでいますが、結果はありません.

    if ($_SERVER['REQUEST_METHOD'] != "POST") die ("No Post Variables"); 


    $req = 'cmd=_notify-validate';

    foreach ($_POST as $key => $value) {
        $value = urlencode(stripslashes($value));
        $req .= "&$key=$value";
    }

    $url = "https://sandbox.paypal.com/cgi-bin/webscr";
    //$url = "https://www.paypal.com/cgi-bin/webscr";
    $curl_result=$curl_err='';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
    curl_setopt($ch, CURLOPT_HTTPHEADER array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($req)));
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
    curl_setopt($ch, CURLOPT_HEADER , 0);   
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    $curl_result = @curl_exec($ch);
    $curl_err = curl_error($ch);
    curl_close($ch);

    $req = str_replace("&", "\n", $req); 



    // Check Number 1 ------------------------------------------------------------------------------------------------------------
    $receiver_email = $_POST['receiver_email'];
    if ($receiver_email != "samuel_1347268213_biz@hotmail.com") {
        $message = "Investigate why and how receiver email is wrong. Email = " . $_POST['receiver_email'] . "\n\n\n$req";
        mail("@hotmail.com", "Receiver Email is incorrect", $message, "From: samuel_1347268213_biz@hotmail.com" );
        exit(); // exit script
    }
    // Check number 2 ------------------------------------------------------------------------------------------------------------
    if ($_POST['payment_status'] != "Completed") {
        // Handle how you think you should if a payment is not complete yet, a few scenarios can cause a transaction to be incomplete
        mail("@hotmail.com", "payment_status", $message, "From: samuel_1347268213_biz@hotmail.com" );
    }

    // Connect to database ------------------------------------------------------------------------------------------------------
    require_once 'connect_to_mysql.php';

    // Check number 3 ------------------------------------------------------------------------------------------------------------
    $payer_email = $_POST['payer_email'];
    $sql = mysql_query("SELECT * FROM transactions WHERE payer_email= '".$payer_email."' LIMIT 1");
    $numRows = mysql_num_rows($sql);
    if ($numRows > 0) {
        $message = "Duplicate transaction ID occured so we killed the IPN script. \n\n\n$req";
        mail("@hotmail.com", "Duplicate txn_id in the IPN system", $message, "From: samuel_1347268213_biz@hotmail.com" );
        exit(); // exit script



$txn = $_POST['txn_id'];

$payer = $_POST['payer_email'];



$l = "INSERT INTO  transactions (txn_id,payer_email)VALUES ('".$txd ."','".$payer ."')";

mysql_query($l)or die;


// Mail yourself the details
$req .= "\n\nDataverified from Paypal!";
mail("@hotmail.com", "NORMAL IPN+++ RESULT", $req, "From: samuel_1347268213_biz@hotmail.com");
4

0 に答える 0