Advertisement
Guest User

Untitled

a guest
Mar 5th, 2014
902
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.64 KB | None | 0 0
  1. <?php
  2.  
  3.     $header = array("X-PAYPAL-SECURITY-USERID:marksyshyperlink-facilitator_api1.gmail.com",
  4.                     "X-PAYPAL-SECURITY-PASSWORD:1393649729",
  5.                     "X-PAYPAL-SECURITY-SIGNATURE:An5ns1Kso7MWUdW4ErQKJJJ4qi4-AV3Mwk0UMZ1QcxcIH41BnL3aj0KX",
  6.                     "X-PAYPAL-REQUEST-DATA-FORMAT:JSON",
  7.                     "X-PAYPAL-RESPONSE-DATA-FORMAT:JSON",
  8.                     "X-PAYPAL-APPLICATION-ID:APP-80W284485P519543T",
  9.                     "Content-Type:text/xml",
  10.                     "Accept: */*"
  11.                     );
  12.      
  13.     $values = array(
  14.         "Content-Type"=>"application/x-www-form-urlencoded",
  15.         "actionType" => "PAY",
  16.         "clientDetails.applicationId" => "APP-80W284485P519543T",
  17.         "clientDetails.ipAddress" => "162.210.70.39",
  18.         "currencyCode" => "USD",
  19.         "feesPayer" => "EACHRECEIVER",
  20.         "memo" => "Sourc Code",
  21.         "receiverList.receiver(0).amount" => "25.00",
  22.         "receiverList.receiver(0).email" => "marksyshyperlink-facilitator@gmail.com",
  23.         "receiverList.receiver(0).primary" => "true",
  24.         "receiverList.receiver(1).amount" => "5.00",
  25.         "receiverList.receiver(1).email" => "marksyshyperlink-facilitator2@gmail.com",
  26.         "receiverList.receiver(1).primary" => "false",
  27.         "requestEnvelope.errorLanguage" => "en_US",
  28.         "returnUrl" => "http://localhost/fluidapp/success.html",
  29.         "cancelUrl" => "http://localhost/fluidapp/cancel.html"
  30.     );
  31. //  $headers = array('X-PAYPAL-SECURITY-USERID: ' . PAYPAL_API_USER, ...)
  32.  
  33.     $Url ="https://svcs.sandbox.paypal.com/AdaptivePayments/Pay/";
  34.    
  35.     // is cURL installed yet?
  36.     if (!function_exists('curl_init')){
  37.         die('Sorry cURL is not installed!');
  38.     }
  39.  
  40.     // OK cool - then let's create a new cURL resource handle
  41.     $ch = curl_init();
  42.  
  43.     // Set URL to download
  44.     curl_setopt($ch, CURLOPT_URL, $Url);
  45.    
  46.      curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
  47.     // Set a referer
  48.     //curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm");
  49.    
  50.     //post data
  51.     curl_setopt($ch, CURLOPT_POSTFIELDS ,$values);
  52.  
  53.     // User agent
  54.     //curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
  55.    
  56.     curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
  57.      
  58.     // Include header in result? (0 = yes, 1 = no)
  59.     curl_setopt($ch, CURLOPT_HEADER, 1);
  60.  
  61.     // Should cURL return or print out the data? (true = return, false = print)
  62.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
  63.    
  64.     curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
  65.    
  66.     curl_setopt($ch, CURLOPT_NOBODY, true);
  67.     // Download the given URL, and return output
  68.     $output = curl_exec($ch);
  69.    
  70.     // Close the cURL resource, and free system resources
  71.  
  72.     $info = curl_getinfo($ch);
  73.     echo "<pre/>";
  74.     print_r($info);
  75.     echo "<br /><br />------------";
  76.     var_dump($output);
  77.    
  78.         curl_close($ch);
  79.  
  80. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement