I would like to use the following to detect if a file exists however there is an internal error when when this is the case. It works fine with file_get_contents is not false.

$nothing = "http://www.google.com/bababababa.doc";
    if (false === file_get_contents($nothing,0,null,0,1)) {
        echo "File Not Found";

    } else {
        echo "File Found";
    }

Thank you.

Read more here: Prevent internal error on false from file_get_contents


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: