Stretchwickster
Programmer
Hi there,
I have the following code and would like to modify it so that I only send an email if a 401 HTTP error is returned from the fopen operation. I've had a scan of the documentation but can't see how to pick up the error number.
Any help would be much appreciated!
Clive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
I have the following code and would like to modify it so that I only send an email if a 401 HTTP error is returned from the fopen operation. I've had a scan of the documentation but can't see how to pick up the error number.
Any help would be much appreciated!
Code:
$testPage = fopen($testURL, 'r');
if (!$testPage) {
echo('<p>Unable to open URL</p>');
$sent = @mail(MAIL_TO, MAIL_SUBJECT, MAIL_MESSAGE, 'From: ' . MAIL_FROM);
if (!$sent) {
exit('Mail could not be sent. Sorry!');
}
}
else {
fclose($testPage);
}
Clive
![Runner_1Revised.gif](http://dev.slydance.com/images/Runner_1Revised.gif)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096