title: PHP : file_get_contents($loc) fails
body: <p>I just moved a project from localhost over to my remote server, and noticed that some of my scripts stopped working. Most importantly was one that relied upon <code>file_get_contents()</code> to fetch JSON values from another script.</p>
  
  <p>PHP Version is 5.2.4<br/>
  <code>allow_url_fopen</code> is ON<br/></p>
  
  <blockquote>
    <p>Warning: <code>file_get_contents()</code> <code>[function.file-get-contents]</code>: <code>php_network_getaddresses</code>: <code>getaddrinfo</code> failed: Name or service not known in <code>/var/www/html/2009/functions/functions.products.php</code> on <code>line 5</code></p>
    
    <p>Warning: <code>file_get_contents(http://data.example.com/new-data.php) [function.file-get-contents]</code>: failed to open stream: <code>Success in /var/www/html/2009/functions/functions.products.php</code> on <code>line 5</code></p>
  </blockquote>
  
  <p>The script is being ran from: <code>http://www.example.com</code><br/>
  The location passed into the function is <code>http://data.example.com/new-data.php</code></p>
  
  <p><strong>Note</strong>: Same domain name, but two different servers.</p>
  
  <pre class="lang-php prettyprint-override"><code>function getData() {
    $location = "http://data.mysite.com/new-data.php";
    $contents = file_get_contents($location);
    $jsonVars = json_decode($contents);
    return $jsonVars
  }
  </code></pre>