title: PHP Warning : file_get_contents failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
body: <p>I have built a local DVD Database using Codeigniter, With film names etc in. What I am looking to do is load in more data for the film from <a href="http://imdbapi.com/" rel="noreferrer">this IMDB API</a>. </p>
  
  <p>However I am getting the following error :</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Warning</p>
    
    <p>Message: file_get_contents(http://www.imdbapi.com/?i=&amp;t=2 Fast 2 Furious) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request</p>
    
    <p>Filename: controllers/dvd.php</p>
    
    <p>Line Number: 92</p>
  </blockquote>
  
  <p>Copying <a href="http://www.imdbapi.com/?i=&amp;t=2%20Fast%202%20Furious" rel="noreferrer">this URI</a> into an address bar returns the json data, But when loading in my page it gives me that error.</p>
  
  <p>It is worth noting I am running on a localhost this particular site. As I am just familiarising myself with Codeigniter. </p>
  
  <p>My code is....</p>
  
  <pre><code>            // Send Query To IMDB Api
  
          $film_q = $film_name[0]-&gt;title;
          $imdb_uri = "http://www.imdbapi.com/?i=&amp;t=$film_q";
          $json = file_get_contents($imdb_uri);
          $json = json_decode($json);
  
          print_r($json);
  </code></pre>
  
  <p><em>EDIT</em> : Looking further into this. Single word film names seem to load in ok, So I'm assuming I need to someway drill down a "+" into the spaces? </p>