function SubmitForm() {
document.getElementById('plandocform').action = "ourscript.php";
document.getElementById('plandocform').submit();
document.getElementById('plandocform').action = "http://www.them.com/theirscript.php";
document.getElementById('plandocform').submit();
}
Unfortunately, this seems not to work sometimes (non-reproducible, about 1/4 of the time). That is, it will submit only to the second form (the other company's form). So is there some way to have the form submit to our page, then forward all the POST info on as POST info to them.com using PHP?
[web] Forward POST info, or submit to 2 pages at the same time?
I'm taking some user info that we need to process and another company also needs to process. When we're done, they should be on the other company's website. Right now I'm doing this:
Lookup curl (http://www.php.net/curl), it should be able to do what you are looking for, beware though, hosts might not have it enabled!
http://pecl.php.net/package/pecl_http - This is also very interesting, but it's not very well documented. See here for a list of functions in that extension.
http://pecl.php.net/package/pecl_http - This is also very interesting, but it's not very well documented. See here for a list of functions in that extension.
cURL's not quite it, I think. Let me clarify--the end result that we want is for the user's web browser to end up looking at www.them.com/theirscript.php as if they had posted directly to it. The post to ourscript.php is just to save a record of their request for audit-trail purposes. So the javascript I posted really does exactly what we want... but only when it works [smile]
I think the closest I could get with cURL is to POST to them.com myself and act as proxy to send the resulting page back to the user, but that's unfortunately not good enough.
I think the closest I could get with cURL is to POST to them.com myself and act as proxy to send the resulting page back to the user, but that's unfortunately not good enough.
Instead of submitting the form twice, you might be able to POST to the first script using XMLHttpRequest.
You could also try something hokey by creating another page. Process the first request on page one, process the second on page two. One redirects to two, two goes where you would normally have it go.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement