I have an online gateway which requires an HTML form to be submitted with hidden fields. I need to do this via a PHP script without any HTML forms (I have the data for the hidden fields in a DB)
To do this sending data via GET:
header('Location: http://www.provider.com/process.jsp?id=12345&name=John');
And to do this sending data via POST?
I used the following code to capture POST data that was submitted from form.php and then concatenate it onto a URL to send it BACK to the form for validation corrections. Works like a charm, and in effect converts POST data into GET data.
An old post but here is how I handled it. Using newms87's method:
Yes, you can do this in PHP e.g. in
using subrequest
Alternatively, setting a session variable before the redirect and test it in the destination url, can solve this problem for me.
I found a better and neater solution so I thought that I should share it:
Use the session:
and for the redirect header request you should use:
307
is thehtttp_response_code
you could use for the redirection request with submittedPOST
values.