I have a form that collects some data and stores it in the SESSION array. After everything is collected, I redisplay this information to verify that it is correct. Upon verification, I want to write the user info to the database, then redirect and post information to paypal.
I can easily redirect using the header function, and this gives me exactly the behavior I'm looking for minus the post data. I've figured out how to post data using cURL, but it doesn't redirect to the new page the way I'd like it too.
Here's some test code. The file name is redir.php.
Code: Select all
<?php
$cs = curl_init("http://www.mysite.com/post.php");
curl_setopt($cs, CURLOPT_POST, 1);
curl_setopt($cs, CURLOPT_POSTFIELDS, "fso=dhgick&bar=face");
curl_setopt($cs, CURLOPT_FOLLOWLOCATION, 1);
curl_exec($cs);
curl_close($cs);
?>