Forum Moderators: coopster

Message Too Old, No Replies

How To Makre Curl To Follow After Submission

         

p33h

9:33 pm on Feb 15, 2009 (gmt 0)

10+ Year Member



Hi everyone,

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]

phparion

8:32 pm on Feb 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



every payment gateway provides a call-back facility, which means on successful payment their server calls back a url on your site which you mention in your admin panel for the service provider. e.g paypal has IPN

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.

sd37167

3:49 am on Feb 18, 2009 (gmt 0)

10+ Year Member



I am doing the EXACT same thing. Don't know if this will work for you or not, but with my CC processor I was able to set the following property to false and it would "show" anything that the submit location returned but still showed my url which I was ok with.

curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, false);

dont know if that is what you are wanting or not, but it worked for me :)