/ Published in: PHP
Source: http://net.tutsplus.com/tutorials/php/using-paypals-instant-payment-notification-with-php/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $req .= "&$key=$value"; } // post back to PayPal system to validate $header = "POST /cgi-bin/webscr HTTP/1.0 "; $header .= "Content-Type: application/x-www-form-urlencoded "; "; if (!$fp) { // HTTP ERROR } else { // PAYMENT VALIDATED & VERIFIED! } // PAYMENT INVALID & INVESTIGATE MANUALY! } } } ?>