title: How to send cookies with file_get_contents
body: <p>I'm trying to get the contents from another file with <code>file_get_contents</code> (don't ask why).<br />
  I have two files: <em>test1.php</em> and <em>test2.php</em>. <em>test1.php</em> returns a string, bases on the user that is logged in.</p>
  <p><em>test2.php</em> tries to get the contents of <em>test1.php</em> and is being executed by the browser, thus getting the cookies.</p>
  <p>To send the cookies with <code>file_get_contents</code>, I create a streaming context:</p>
  <pre><code>$opts = array('http' =&gt; array('header'=&gt; 'Cookie: ' . $_SERVER['HTTP_COOKIE'].&quot;\r\n&quot;))`;
  </code></pre>
  <p>I'm retrieving the contents with:</p>
  <pre><code>$contents = file_get_contents(&quot;http://www.example.com/test1.php&quot;, false, $opts);
  </code></pre>
  <p>But now I get the error:</p>
  <blockquote>
  <p>Warning: file_get_contents(<a href="http://www.example.com/test1.php" rel="nofollow noreferrer">http://www.example.com/test1.php</a>) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found</p>
  </blockquote>
  <p>Does somebody knows what I'm doing wrong here?</p>
  <p>edit:<br />
  forgot to mention: Without the <em>streaming_context</em>, the page just loads. But without the cookies I don't get the info I need.</p>