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 file_get_contents() to fetch JSON values from another script.
PHP Version is 5.2.4
allow_url_fopen is ON
Warning:
file_get_contents()[function.file-get-contents]:php_network_getaddresses:getaddrinfofailed: Name or service not known in/var/www/html/2009/functions/functions.products.phponline 5Warning:
file_get_contents(http://data.mysite.com/new-data.php) [function.file-get-contents]: failed to open stream:Success in /var/www/html/2009/functions/functions.products.phponline 5
The script is being ran from: http://www.mysite.com
The location passed into the function is http://data.mysite.com/new-data.php
Note: Same domain name, but two different servers.
function getData() {
$location = "http://data.mysite.com/new-data.php";
$contents = file_get_contents($location);
$jsonVars = json_decode($contents);
return $jsonVars
}