Hi dclow,
Neat problem! When you say that some data will be returned from the POST, how will that work exactly? Will there will be some sort of a callback made by the 3rd party server to your own, that contains some a unique identifier to map the two POST requests? Or does the server simply generate something to display, which you then scrape?
You could tackle this in a few different ways, but I'd personally approach it like so. It's kind of high-level, but it sounds like you can handle the details.
First off, use an
API form so that you have more control over the whole form submission process. Right before you redirect to the "thankyou" page on your form (i.e. before the final ft_api_process_form() function call), construct the XML in a string out of the values entered into the form up to that point. They're returned by ft_api_ini_form_page() - which you'd have already called at that point anyway. (
see this page for a little more info about the PHP functions).
In terms of getting the info BACK and adding it to the submission, if the server's just displaying the data that's simplest.
Do a
curl request to post the data to the 3rd party server. That's the simplest approach - assuming it's installed on your server. Make sure you use curl_setopt() with a CURLOPT_RETURNTRANSFER of true. That will make the final curl_exec call return the generated page content in a string.
Finally, you can then parse out the data and add it to the $_POST request before using the final ft_api_process_form() function, which will automatically add the data to the database (assuming you've added those fields to the form via the admin panel).
Oof. Reading over the above I guess this covers a lot of ground... It's kind of a mouthful to explain, but it's very doable!
Let me know if I'm not clear on anything or if I misunderstood any of your requirements.
- Ben