Advertisement
ezako

test44.php

Dec 29th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.34 KB | None | 0 0
  1. <?php
  2. echo '<pre>';
  3.  
  4. //verified
  5. $raw_post_data="transaction_subject=&payment_date=21:31:49 Dec 28, 2017 PST&txn_type=web_accept&last_name=Panomporn&residence_country=TH&item_name=3 GigaByte Membership Upgrade&payment_gross=2.99&mc_currency=USD&business=ezako@gem-flash.com&payment_type=instant&protection_eligibility=Ineligible&verify_sign=A3vfKh1Q0f72l4jYfh5sj-PNozXJAxmTFkDx1s-Fjgl6rcgZVVcOvIN6&payer_status=unverified&payer_email=sathaporn1978@gmail.com&txn_id=9MP05434MM9782326&quantity=1&receiver_email=ezako@gem-flash.com&first_name=Sathaporn&payer_id=SEAJ6EW9RYZJ4&receiver_id=J9KM5NZ2FFD7J&item_number=&payment_status=Completed&payment_fee=0.42&mc_fee=0.42&mc_gross=2.99&custom=110843&charset=windows-1252&notify_version=3.8&ipn_track_id=1b24f4516c1d";
  6.  
  7. $raw_post_array = explode('&', $raw_post_data);
  8. $myPost = array();
  9. foreach ($raw_post_array as $keyval) {
  10.   $keyval = explode ('=', $keyval);
  11.   if (count($keyval) == 2)
  12.     $myPost[$keyval[0]] = rawurldecode($keyval[1]);
  13. }
  14.  
  15. print_r($myPost);
  16.  
  17. $req = 'cmd=_notify-validate';
  18. if (function_exists('get_magic_quotes_gpc')) {
  19.   $get_magic_quotes_exists = true;
  20. }
  21. foreach ($myPost as $key => $value) {
  22.   if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
  23.     $value = rawurlencode(stripslashes($value));
  24.   } else {
  25.     $value = rawurlencode($value);
  26.   }
  27.   $req .= "&$key=$value";
  28. }
  29.  
  30. // Step 2: POST IPN data back to PayPal to validate
  31. $ch = curl_init('https://ipnpb.paypal.com/cgi-bin/webscr');
  32. curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  33. curl_setopt($ch, CURLOPT_POST, 1);
  34. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  35. curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
  36. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
  37. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  38. curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
  39. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
  40. // In wamp-like environments that do not come bundled with root authority certificates,
  41. // please download 'cacert.pem' from "https://curl.haxx.se/docs/caextract.html" and set
  42. // the directory path of the certificate as shown below:
  43. // curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
  44. if ( !($res = curl_exec($ch)) ) {
  45.   // error_log("Got " . curl_error($ch) . " when processing IPN data");
  46.   curl_close($ch);
  47.   exit;
  48. }
  49. curl_close($ch);
  50.  
  51. print_r($res);
  52.  
  53.  
  54. echo '</pre>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement