I'm using this curl function to load the remote file file.php.
$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://example.com/file.php");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    if(curl_exec($ch) === FALSE) {
         echo 'No file';
    } else {
         echo curl_exec($ch);
    }
    curl_close($ch);
But if the file does not exist, I get the standard server 404 file at example.com.
How can I get curl to echo the "No file" text?
I've looked at this question Easy way to test a URL for 404 in PHP? but I think a simpler example would be useful.
