title: Get Querystring values from Location Header in PHP
body: <p><strong>UPDATE</strong></p>
  
  <p>Let's say, my users went to this page:</p>
  
  <pre><code>https://www.abc.com/mypage.php
  </code></pre>
  
  <p>The response headers for that page are:</p>
  
  <pre><code>    Content-Length  28
      Date    XXXX
      Location    https://abc.com/error.php?target=https%3A%2F%2Fabc.com%2Fmypage.php&amp;
  errorReason=Go+To+this+Url
      Server  MochiWeb/1.1 WebMachine/1.10.5 (jokes are better explained)
  </code></pre>
  
  <p>That means the page is redirecting to <code>https://www.abc.com/errorpage.php</code> with the querystring params in the <code>Location</code> header.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Is there any way to get the Location header from the redirect? I am not seeing using getallheaders() or any other PHP function.</p>
  
  <p>Thanks</p>