I am learning php, I want to create a page users can send a post response, redirect to another page and pass the token i get from a service in the body to a header to the redirect site.
I understand that i can redirect via header("Location: http://www.example.com/");
, how do i capture a body parameter of the form Token blahblah
and then pass it as a header Bearer blahblah
So far i have
<?php
if(isset($_POST['submit']))
{
$headers = $_POST['token'];
if ($headers) {
header('Location: http://www.example.com/');
}
}
?>
I am ok with adding javascript because it seems like its not possible to send custom headers with redirect in php - Redirect to page and send custom HTTP headers