dagon;10942749 wrote:first submit the form to your site, where you can get the information you need then use CURL (for post) or header (for get) to submit the form to the merchant. At least that's how i do it in exactly the same situation.
Dagon:
I have been trying to do something like that..
I'm not too familiar with curl
I tried the following which I found on http://davidwalsh.name/execute-http-post-php-curl
After I hit submit, it shows me the payment gateway and the fields are filled out. The URL in the browser is my site's and when I click 'submit' it tries to bring me to mysite.com/transact.pl which obviously doesn't exist.
extract($_POST);
//set POST variables
$url = 'https://www.eProcessingNetwork.com/cgi-bin/dbe/order.pl';
$fields = array(
'Total'=>urlencode($Total),
'ePNAccount'=>urlencode($ePNAccount),
'FirstName'=>urlencode($FirstName),
'LastName'=>urlencode($LastName),
'Address'=>urlencode($Address),
'City'=>urlencode($City),
'State'=>urlencode($State),
'Zip'=>urlencode($Zip),
'EMail'=>urlencode($EMail),
'ID'=>urlencode($ID),
'ReturnApprovedURL'=>urlencode($ReturnApprovedURL),
'ReturnDeclinedURL'=>urlencode($ReturnDeclinedURL),
'Phone'=>urlencode($telephone)
);
//url-*** the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
MOD EDIT: [noparse]
..
[/noparse] bbcode tags changed to [noparse]
..
[/noparse] tags.