Reputation: 2615
I'm trying to submit to Paypal Website Payments Pro through cURL. I'm trying to do something like this:
// set vars
$cmd = "_cart";
$upload = "1";
$business = "[email protected]";
$req = "cmd=$cmd&upload=$upload&business=$business";
$req .= "&".postToEncoded($_POST);
$url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // test
// $url= 'https://www.paypal.com/cgi-bin/webscr'; // live
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$res = @curl_exec($ch);
$curl_err = curl_error($ch);
curl_close($ch);
I've tried a ton of options read different places and I have yet to get this to work. I just want to be able to pass my extra vars to Paypal then continue on loading the PP site with the added vars. The post is working fine, but I don't know how to get it to go to the PP site!
Upvotes: 0
Views: 1037
Reputation: 2409
I recently had the same problem and I end up creating my own set of classes for integration with PayPal. I wrote a detailed tutorial on how to integrate PayPal Website Payments Standard with your custom PHP shopping cart.
Upvotes: 1
Reputation: 1173
If you are trying to redirect your customer to a paypal page with your parameters - you can approach this differently. Have your form that makes the POST add 3 hidden fields which you set to your variables, and form's action
be PayPal's page. That way customer will get there immediately, without PHP.
Would this work for your situation? Or am I misunderstanding something?
Upvotes: 1