Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $request = "cmd=_notify-validate";
- foreach ($_POST as $varname => $varvalue){
- $email .= "$varname: $varvalue\n";
- if(function_exists('get_magic_quotes_gpc') and get_magic_quotes_gpc()){
- $varvalue = urlencode(stripslashes($varvalue));
- }
- else {
- $value = urlencode($value);
- }
- $request .= "&$varname=$varvalue";
- }
- $ch = curl_init();
- curl_setopt($ch,CURLOPT_URL,"https://www.paypal.com/cgi-bin/webscr");
- curl_setopt($ch,CURLOPT_POST,true);
- curl_setopt($ch,CURLOPT_POSTFIELDS,$request);
- curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
- $result = curl_exec($ch);
- curl_close($ch);
- switch($result){
- case "VERIFIED": //Payment went through all right,
- break;
- case "INVALID": // Invalid or fake payment.
- break;
- default:
- // any other case (such as no response, connection timeout...)
- }
- ?>
Add Comment
Please, Sign In to add comment