I need a PHP script that gets a POST request and redirects it to another page as a GET request with all parameters in the URL.
Is this possibile?
I need a PHP script that gets a POST request and redirects it to another page as a GET request with all parameters in the URL.
Is this possibile?
You can use the function http_build_query()
to generate the GET query string from $_POST
.
Afterwards attach it to the redirect URL and use header()
with Location for the redirect, for example:
$newURL = 'http://example.com/script.php?' . http_build_query($_POST);
header("Location: {$newURL}");