Jump to content

Parse error: syntax error, unexpected $end?


ask9

Recommended Posts

hello guys

 

I received this error below,

Parse error: syntax error, unexpected $end in /home/coder9/public_html/paypal/sandbox/pdf-ipn/listener.php on line 65

 

These are the codes,

http://coder9.com/paypal/sandbox/pdf-ipn/listenertxt.txt

 

I hope someone will tell me what's wrong with this?

 

Thanks in advance.

 

 

Link to comment
https://forums.phpfreaks.com/topic/209749-parse-error-syntax-error-unexpected-end/
Share on other sites

You're missing a closing curly brace for the while loop. If you indent the code properly it's easier to spot (second to last line):

 

} else {
// NO HTTP ERROR
// TODO: Verify that HTTPS response is 200
fputs ($fp, $header . $req);
while (!feof($fp)) {
        $res = fgets ($fp, 1024);
        if (strcmp ($res, "VERIFIED") == 0) {
            // TODO:
            // 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
            // If 'VERIFIED', send an email of IPN variables and values to the
            // specified email address
            foreach ($_POST as $key => $value){
                $emailtext .= $key . " = " .$value ."\n\n";
            }
            mail($email, "Live-VERIFIED IPN", $emailtext . "\n\n" . $req);
        } elseif (strcmp ($res, "INVALID") == 0) {
            // If 'INVALID', send an email. TODO: Log for manual investigation.
            foreach ($_POST as $key => $value){
                $emailtext .= $key . " = " .$value ."\n\n";
            }
            mail($email, "Live-INVALID IPN", $emailtext . "\n\n" . $req);
        }
    } // was missing
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.