无法打开流:无主机路由[重复]

$test = json_decode(file_get_contents(URL));
print_r($test);

above code was working perfect just a day back on my bluehost account. not it stopped working and giving me error.

Warning: file_get_contents(URL): failed to open stream: No route to host in /home/xxx/public_html/test1.php on line 8

URL is like external resource of API. any clue about it? i tried to contacted with bluehost support team and they said they can't help me to resolve php errors and my guess is, this is server side issue. edit: same code is working wamp server installed on my local machine. EDIT:

TRACEROUTE Via ssh
traceroute http://url
http://url: Name or service not known
Cannot handle "host" cmdline arg `http://url' on position 1 (argc 1)
</div>

check configuration on your server using phpinfo().

check "allow_url_fopen" value it should be 1 in php.ini if it is not set 1 then please check with your hosting partner for the same.

You can also call external URL using cURL.

<?php
$url = "http://www.example.org/";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$contents = curl_exec($ch);
if (curl_errno($ch)) {
   echo curl_error($ch);
   echo "
<br />";
   $contents = '';
} else {
  curl_close($ch);
}

echo $contents;

?>

Note : check your cURL Extension is enabled on server and in your local system.

Hope this will helps.