views:

16

answers:

0

Iam doing parsing and for that i need an error handler that should send mail only when a page is not opening up or is going on not found or is forbidden or something. What iam using currently is this :-

function customError($errno, $errstr, $errFile, $errLine)
{
    switch ($errno)
    {
        case E_ERROR:error_log("ERROR:in $errFile [$errno] $errstr at $errLine",1,"[email protected]","From: [email protected]");die();
        break;

        case E_WARNING:error_log("WARNING:in $errFile [$errno] $errstr at $errLine",1,"[email protected]","From: [email protected]");die();
        break;
        case E_NOTICE:
    }
    return true;
}

set_error_handler("customError");

this send mail even if sometimes a connection is refused for a second or so and i have a junk of mails daily.I need that only when a page goes on not found or is forbidden or cannot be opened at all then only a mail should be sent otherwise not.

please guide on this!