Guest User

Untitled

a guest
Sep 2nd, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. $request = "cmd=_notify-validate";
  5. foreach ($_POST as $varname => $varvalue){
  6. $email .= "$varname: $varvalue\n";
  7. if(function_exists('get_magic_quotes_gpc') and get_magic_quotes_gpc()){
  8. $varvalue = urlencode(stripslashes($varvalue));
  9. }
  10. else {
  11. $value = urlencode($value);
  12. }
  13. $request .= "&$varname=$varvalue";
  14. }
  15. $ch = curl_init();
  16. curl_setopt($ch,CURLOPT_URL,"https://www.sandbox.paypal.com/cgi-bin/webscr");
  17. //curl_setopt($ch,CURLOPT_URL,"https://www.paypal.com");
  18. curl_setopt($ch,CURLOPT_POST,true);
  19. curl_setopt($ch,CURLOPT_POSTFIELDS,$request);
  20. curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);
  21. curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  22. $result = curl_exec($ch);
  23. curl_close($ch);
  24. switch($result){
  25. case "VERIFIED":
  26. // verified payment
  27. echo 'success';
  28. break;
  29. case "INVALID":
  30. // invalid/fake payment
  31. echo 'invalid/fake payment'
  32. break;
  33. default:
  34. // any other case (such as no response, connection timeout...)
  35. }
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment