I want to check the url
http://example.com/file.txt
exist or not in php. How can I do it?
if(! @ file_get_contents('http://www.domain.com/file.txt')){
echo 'path doesn't exist';
}
This is the easiest way to do it. If you are unfamiliar with the @
, that will instruct the function to return false if it would have otherwise thrown an error