title: HTTP/1.1 505 HTTP Version Not Supported
body: <p>I'm running a PHP script to grab a web page. It worked fine with many sites, but with one site it fails, returning an error saying "HTTP/1.1 505 HTTP Version Not Supported".</p>
  
  <p>This is (part of) my script:</p>
  
  <pre><code>for($i = 0; $i &lt; 1; $i++) {
      $page = file_get_contents("http://www.lovelybooks.de/stoebern/empfehlung/romantic fantasy/?seite=$i");
      // do something with $page
  }
  </code></pre>
  
  <p>Many answers recommend setting the HTTP version explicity. I have tried setting 0.9, 1.0 and 1.1, but it did not change anything. And actually the headers seems to show that the HTTP version requested by my browser and that expected by the server match:</p>
  
  <p>Reply headers:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Mon, 15 Dec 2014 09:01:15 GMT
  Server: Apache
  X-Powered-By: PHP/5.4.35
  Keep-Alive: timeout=2, max=200
  Connection: Keep-Alive
  Transfer-Encoding: chunked
  Content-Type: text/html
  </code></pre>
  
  <p>Request headers:</p>
  
  <pre><code>GET /path/script.php HTTP/1.1
  Host: www.mydoman.de
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:34.0) Gecko/20100101 Firefox/34.0
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: de,en-US;q=0.7,en;q=0.3
  Accept-Encoding: gzip, deflate
  DNT: 1
  Authorization: Basic MjQwMjE5Njc6MDcwNjIwMDc=
  Connection: keep-alive
  Cache-Control: max-age=0
  </code></pre>
  
  <p><strong>What else can be wrong?</strong></p>