I am using cURL to post an item to Website Payments Standard in PayPal. My code, curl.donate.php is as follows...
$string = '';
foreach($_POST as $key=>$value) $string .= $key.'='.$value.'&';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim($string, '&'));
curl_setopt($ch, CURLOPT_URL, 'https://www.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec($ch);
curl_close ($ch);
I invoke curl.donate.php from the donate.php page which calls an ajax call to the script like so...
$.ajax({
type: 'POST',
url: 'curl.donate.php',
data: 'business=myemail@yahoo.com&add=1&cmd=add&display=1&item_name=Donation for John Doe&amount=25.00&on0=Memory&os0=John Doe&on1=Send Acknowledgement To&os1=Jane Smith&on2=Address&os2=123 Main Street&on3=City, State Zip&os3=Naples, FL 34104',
success: function(data){
console.log(data);
}
});
When the page runs it prints out the entire PayPal home page in the firebug console. Therefore, it isn't posting something to the cart correctly.
PLEASE HELP! :)