title: How to add multiple headers to file_get_content in PHP
body: <pre><code>$opts = array('http' =&gt; array('method' =&gt; $_SERVER['REQUEST_METHOD'],
                                'header' =&gt; array(&quot;Accept-language: en\r\n&quot;,
                                                  &quot;Cookie: &quot; . session_name() . &quot;=&quot; . session_id() . &quot;\r\n&quot;,
                                                  &quot; Content-type: application/x-www-form-urlencoded\r\n&quot;),
                                'content' =&gt; $_POST));
  $postdata = http_build_query($_POST);
  
  $context = stream_context_create($opts);
  
  session_write_close(); // This is the key
  
  echo $obsah = file_get_contents(&quot;http://localhost/journal/&quot;, false, $context);
  </code></pre>
  <p>This code is not working with <a href="https://en.wikipedia.org/wiki/POST_%28HTTP%29" rel="nofollow noreferrer">POST</a> and cookies.</p>