Prevent internal error on false from file_get_contents

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

Leave a Reply

Your email address will not be published. Required fields are marked *