Re: $_POST values to Worldpay https thru a script and not a form
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: $_POST values to Worldpay https thru a script and not a form

From: Angelos <angelos@redcatmedia.net>
Date: Tue Apr 11 2006 - 17:24:19 CEST

Angelos wrote:
> Hello,
>
> For long time now I am trying to POST some variables from a form to a
> script and then that script POST them to another External page or
> payment gateway like worldpay.
>
> The reason I want to do that is because I want the user to enter his
> details in my website and then post them in Worldpay and continue any
> other steps he has to do to pay and then ofcourse using the callback
> function right back to the database if the transaction was Succesfull or
> not.
>
> I used curl like in the example bellow:
> $urlString = "cartId=56997&name=fred";
> $ch = curl_init("https://select.worldpay.com/wcc/purchase");
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $urlString);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> echo $data = curl_exec($ch);
> curl_close($ch);

$urlString = "action=1&action=2";
$url = "https://select.worldpay.com/wcc/purchase";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,$urlString);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_exec ($ch);
curl_close ($ch);

THat does exactly the same...
without the echo.

:s
Received on Mon May 1 02:53:16 2006