forwarding a form to another server

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi there everyone.

Right I have scoured everywhere to find out how to do this and I
haven't the foggiest...

I am building a shopping cart that uses an external clearing house
[world pay].

My shopping cart sequence is :

 Checkout page [show the contents of the cart etc] ----> Confirmation
confirm the details of the cart, finalise totals etc -------> Forward
to world pay for card transaction -------> On completion world pay does
a "call back" that executes a page on my site which effectively
confirms that the trasaction took place [puts in transax ids etc into
my database for order management].

This works great however what has happened is that sometimes world pays
call back doesn't fire when it should have due to internet congestion
etc the request times out. Because the order isn't confirmed until we
get the call back needless to say this causes a problem.

So what I want to do is basically put an invisible page in between our
confirmation screen [where the user says "Yes this is correct take me
to world pay"] and the first world pay screen [enter your card

Where I am having troubles though is I want this page to be invisible.
I need to submit the confirmation page form to this hidden page and
then *automatically" submit the resulting form to world pay - and move
the users' browser along as well. I don't want the user to have to
submit the page again though and I certainly don't want to hack it with
a onLoad="form.Submit()" type thing in Javascript on my hidden page -
it has to be accessible for people without JavaScript switched on.

I'm sure it is a case of writing the headers or soemthing but the only
things I can find are using fsockopen which submits a request and
downloads the results into the originating page. I want to forward the
browser entirely.

Any help would be very much appreciated.

Kind regards

Re: forwarding a form to another server

Does the data have to be post? Because if it was method GET then you
could do something a bit like this I suppose:


#Get all of the data using $_GET[]; and $_POST[];

$gets = ""; //You should arange them in this variable, in the GET style
format like: id=$id&text=$text

header("Location: /?$gets");


Tell me if that works, I am curious about it.

Re: forwarding a form to another server

See this post:

Re: forwarding a form to another server

Hi CL.

Thanks for the post [entertaining read as well ;) ] however this won't
work in my case because firstly the cURL extensions aren't available
[limited hosting company - not my fault!] and secondly I don't want to
read the data back to my site. I need to transter the entire session to
the new host for post-processing....


Re: forwarding a form to another server

AndrewF wrote:
Quoted text here. Click to load it

First, you don't need cUrl to use the stream API functions. They're a
standard part of PHP 4.3+.

Second, if you want the post to occur transparently, then you have to
proxy the whole transaction. The HTTP status code 307 will redirect a
post, but some browsers would prompt the user to confirm the action

Site Timeline