i have a form with userdata, such as name, address, email etc. and i wanna do a action to a page on a foreign domain which i can not manipulate. Normally i would say that the form should do action="www.notmydomain.com/externalscript.php" to send the data via POST, but now i first wanna save this data an then submit the formdata to this target. This isn´t possible in this case so I tried to send my formdata to another script on MY server which saves the data an then reuses the POSTvars and send it with curl. This works so far but i need to redirect to http://www.notmydomain.com/theforeignscript.php so that the user ends at this domain. curl doesn´t do that because it only can do request, right?!
The first page shows the form:
<form id="newsletter" action="myscript.php" method="post">....</form>
..which is used by myscript.php to save the data in a csv and then again should submit the data to http://www.notmydomain.com/externalscript.php (which cannot be edited)…
Has anybody a hint how this could be done?
Thanks in advance.
You can use
header("Location: http://domain.com/script.php");to redirect the user to another address. This needs to be executed before anything is printed by your script, so make sure you catch all curl errors etc. properly to avoid ugly PHP error messages.