title: PHP | How to get headers from GET Request?
body: <p>I want to display the received headers from the GET Request that I send,</p>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  $opts = array(
  'http'=&gt;array(
  'method'=&gt;"GET",
  'header'=&gt;"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0"
  ));
  $context = stream_context_create($opts);
  $url = "http://spys.me/proxy.txt";
  // instead of file_get_contents
  $data = getallheaders($url, false, $context);
  
  echo $data;
  </code></pre>