View Full Version : Need help with <form> processing in PHP

03-05-2003, 08:23 PM
The project I'm working on uses a <form> on Website1 to pass user supplied data to a different website: Website2. (Pretty simple so far!)

The problem is that I want to process some or all of the information on the original Website1 too; such as logging the clickthru and some of the data in a database.

I can get the <form> to "POST" to a PHP script on Website1 which logs the click-thru but how can I then re-send or re-"POST" the original data to Website2?

Or would a better approach be to have the process "branch" somehow so that both things happen simultaneously. Maybe by passing the data to a new separate window which opens a PHP script, processes the data, and then closes the window only leaving the original window with Website2 showing. Could this be done with the javascript "onClick=" thing added to the SUBMIT tag like:

<input type=Submit onClick="http://www.Website1.com">

Any thoughts? Have I made this clear or confusing?

03-05-2003, 08:37 PM
The javascript approach you described would work, though it's rather messy and may confuse the user (having an window opening, closing with no message, and then the form submits). You can save yourself from this hassle with one of three alternative routes:

1.) Use the Snoopy class that acts like a webbrowser to send your POST request to website2:

2.) Use the cURL extension to send the POST request (may not be installed everywhere, check your host for details):

3.) If none of the above should work, you can still try to open a socket and do it the *really* hard way with fsockopen():