I'm using cURL to post form data to an affiliate's site.
The problem is that the affiliate's forms are twofold. In the first part of their form, an email address is entered, and after pressing submit, another form with a confirmation of the user's email address is displayed (along with more form fields).
We want the user to just enter their email address on our site and then send that data to these other forms, for the following reasons:
(1) We want to capture the user's information for our own database
(2) We want the user to enter their email address only once
(3) We don't want the user to go through a 2-step form
Normally, if it's just one form, I use the following code:
$url="http://someaffiliateurl.com/affiliateform.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "fieldA=".$valueA."&fieldB=".$valueB.");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
$content = curl_exec ($ch); # This returns HTML
curl_close ($ch);
But, this only posts to one url. I've tried just passing information directly to that second affiliate form, but the second form receives information from the first.
Namely, AffiliateFormA passes a hidden field ("x") with our account id ("12345678") and the email address to AffiliateFormB.
I've tried setting the above $url to
http://affiliatesite.com/AffiliateFormB?x=12345678, but this just redirects to the first form.
Anyone know how I can either:
(1) Post directly to the second form, or
(2) Pass information from the first form to the second form automatically?
Thanks much!