UPDATE
Let's say, my users went to this page:
https://www.abc.com/mypage.php
The response headers for that page are:
Content-Length 28
Date XXXX
Location https://abc.com/error.php?target=https%3A%2F%2Fabc.com%2Fmypage.php&
errorReason=Go+To+this+Url
Server MochiWeb/1.1 WebMachine/1.10.5 (jokes are better explained)
That means the page is redirecting to https://www.abc.com/errorpage.php
with the querystring params in the Location
header.
Now on errorpage.php, instead of using $_GET to get the querystring parameters, I wanted to get the Location header, parse out the parameters and print them.
The downside to doing $_GET is, my users can enter any crap in the querystring and my errorpage.php will print it. So i wanted to avoid that by detecting the Location header.
Is there any way to get the Location header from the redirect? I am not seeing using getallheaders() or any other PHP function.
Thanks