Need help with my PayPal IPN Script in PHP
Nerks
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Nov-12-2018
11:39 AM
Hello! There is something wrong with my PHP script for the callback PayPal IPN request. I made it so that it sends the results back to a txt file which I can see and by the statistics the file_get_contents seems to not be getting a VERIFIED nor INVALID return back, and seems to just be timing out instead.
Could someone please help me with this? Thank you very much.
<?php // Get POST data and refine the GET value. foreach ($_POST as $name => $value) { $postdata = $name.'='.$value.'&'; $result .= substr('?'.$postdata, 0, -1); } // Verify that payment was really made. $verify = file_get_contents('https://ipnpb.sandbox.paypal.com/cgi-bin/webscr/'.$result.''); if ($verify == "VERIFIED") { // Any code run here will only be run if payment is verified. echo 'Payment success!'; $data = "Payment made successfully."; $fp = fopen('stats.txt', 'a'); fwrite($fp, $data); } elseif ($verify == "INVALID") { echo 'Payment Declined.'; $data = "The payment isn't valid."; $fp = fopen('stats.txt', 'a'); fwrite($fp, $data); } else { echo 'An unexpected error occured.'; $data = "A timeout error occured."; $fp = fopen('stats.txt', 'a'); fwrite($fp, $data); } // Let PayPal know that the IPN was successful. header("HTTP/1.1 200 OK"); ?>
Labels:
0 REPLIES 0

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- How does someone who don't have or want a PayPal account send money to my PayPal account? in My Money Archives
- Sending money in My Money Archives
- inviting a friend in PayPal Basics Archives
- Paypal ask payment method twice in My Money Archives
- Error - Sorry, PayPal Plus is currently not available in My Money Archives