paypal IPN php script

Ich habe gerade festgestellt, dass mein paypal-ipn-handler in php nicht mehr funktioniert (und ich nichts ändern), ich benutze die Beispiel-php-script von paypal bereitgestellt wird.

Habe ich versucht, das problem zu isolieren, indem Sie mehrere test -, und in dieser Zeit kann ich sagen, dass das problem nicht das "VERIFIED" oder die "UNGÜLTIG" - Sache, aber kommt von diesen Zeilen:

[...]

fputs ($fp, $header . $req);
    while (!feof($fp))
    {
        $res = fgets ($fp, 1024);
        if (strcmp ($res, "VERIFIED") == 0)
        {
        //check the payment_status is Completed

[...]

Wer weiß, ob paypal etwas ändern oder warum funktioniert es nicht?

Dank'

ps: wenn ich meinen code vor allen die paypal-tests (vor der Zeile "if (!$fp)") es nur funktioniert

Dies ist mein code, ich Kommentar wo sich die "Datenbank-Prozess" funktioniert und wo nicht.

<?php

//read the post from PayPal system and add 'cmd'
$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.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);

//assign posted variables to local variables
$payment_status = $_POST['payment_status'];


//DATABASE PROCESS WORKS (BEFORE THE PAYPAL TESTS)



if (!$fp)
{
    //HTTP ERROR
}
else
   {

//DATABASE PROCESS WORKS

    fputs ($fp, $header . $req);
    while (!feof($fp))
    {
        $res = fgets ($fp, 1024);
        if (strcmp ($res, "VERIFIED") == 0)
        {
            //check 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 payment


//DATABASE PROCESS NOT WORKING

        }
        else if (strcmp ($res, "INVALID") == 0)
        {
            //log for manual investigation

//DATABASE PROCESS NOT WORKING
        }
    }
fclose ($fp);
}

?>
haben Sie überprüfen Sie error_log zu diesem problem ?
Wie kann ich überprüfen, error_log bitte?

InformationsquelleAutor pol | 2012-09-29

Schreibe einen Kommentar