Sign in to follow this  
BeanDog

[web] Forward POST info, or submit to 2 pages at the same time?

Recommended Posts

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:
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this