Log in

View Full Version : File_Get_Contents Error.



MrCraig
25-03-2008, 05:08 PM
Hey,
From time to time, this error comes up using the file_get_contents function



Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/****/public_html/user/func.php on line 11


Does anyone know how to bypass this error/know whats causing it/suggest a function that wont cause this error but does the same job?

Thanks for any helpful input :)

Craig.

Robbie
25-03-2008, 05:28 PM
Try the IP instead of the domain. (In the function)

MrCraig
25-03-2008, 07:54 PM
The IP would just link to pycan site..

Independent
25-03-2008, 07:58 PM
The IP would just link to pycan site..

I was tinkering with file get contents a few day's ago..

and it had a function to echo so many bytes.. if you've done

file_get_contents('http://www.somesite.com/pages/lol.php');

I don't believe that would work.

http://us2.php.net/file_get_contents

<?
$content=file_get_contents("http://www.google.com (http://www.google.com/)",FALSE,NULL,0,20);
echo $content;
?>

Would work I believe.

MrCraig
26-03-2008, 04:17 PM
Hasnt made any difference :S

Any other suggestions?

Invent
26-03-2008, 04:20 PM
It's not a PHP error, it's a DNS one. Ask your host to ping the site you're trying to use f_g_c() on and if it can't ping the url, then that's your problem.

Robbie
26-03-2008, 04:26 PM
Whenever this has happened to me before Ive used the IP, like say my hosts IP was 127.0.0.1 I'd do

file_get_contents("http://127.0.0.1/~myaccountname/php/files/uberleethaxorfile.htm");

MrCraig
26-03-2008, 04:40 PM
Well its only happening on one site that its being used on..

So i dont know if its the server that the sites ons problem..

And robbie, that works xD

So i will probably switch to using that method.

Want to hide these adverts? Register an account for free!