Jump to content

[SOLVED] Checking an external file exists?


tomtom

Recommended Posts

Hey.

 

How can you check an external file exists?

 

I'm trying

 

if(file_get_contents("http://myfile.com/test.ini")) {

   // do my code if the file exists

}

 

right.

 

But I just get

 

Warning: file_get_contents(http://myfile.com/test.ini) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in...

 

etc. Any suggestions? I want it to return true if the file exists; but if it doesn't exist -  I don't want it to return that error - or any error lol.

 

Cheers guys (y)

Link to comment
https://forums.phpfreaks.com/topic/120563-solved-checking-an-external-file-exists/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.