title: Why I'm getting 500 error when using file_get_contents(), but works in a browser?
body: <pre><code>$html = file_get_contents(&quot;https://www.[URL].com&quot;); 
  echo $html;
  </code></pre>
  <p>produces this in the error logs:</p>
  <blockquote>
  <p>PHP Warning:  file_get_contents(https://www.[URL].com) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /Applications/MAMP/htdocs/test.php on line 13&quot;;</p>
  </blockquote>
  <p>However, the site works fine in a browser.</p>
  <p>I tried using cURL as well. I don't get any errors in the log file, but <code>$html</code> now echoes:</p>
  <blockquote>
  <p>Server Error in '/' Application.<br />
  Object reference not set to an instance of an object.</p>
  <p>...some more debugging info</p>
  </blockquote>
  <p>Any ideas how to work around this?</p>