Forum Moderators: coopster
I've got a "Pay" button on my site and I would like to redirect users who clicks on this button to the page with curl script which will auto submit a form to the merchant site and redirect users along with itself and all the form details to the submit location.
Basically I thought that this will be a workaround so users won't be able to spy on my form source code and get the download url from it
I've got this curl script, bu actually I've no idea whether it's good or not:
<?php
$url = 'https://ssl.example.com/';
$params = "waluta=PLN&kanal=11&ch_lock=1&id=24667&type=0&opis=Dekalog&kwota=47.77&download_url=http://www.xx.com/x.php"; //you must know what you want
$user_agent = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_close ($ch);
echo "Results: <br>".$result;
?>
How to make this script to redirect users who reach it along with the form submission?
[edited by: eelixduppy at 12:29 am (utc) on Feb. 16, 2009]
[edit reason] exemplified [/edit]
the basic idea is that you can mention specific variables in your form that you need the payment gateway server to post on your call back url. Then on your call back URL you check different things to make sure the call made is not a direct call but a call from payment gateway server and then you forward user to download page or update database values.
services like 2checkout sends a hash value back to your site and you can match that value by posting back the value to make sure it is a call from only 2co server.
so what you need to do is search for a similar facility in your payment gateway or talk to their support about this.
I hope it helps.
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, false);
dont know if that is what you are wanting or not, but it worked for me :)