On Tue, 2003-06-03 at 04:06, Ernest E Vogelsinger wrote:
> At 07:55 03.06.2003, Kjell Hansen said:
> --------------------[snip]--------------------
> >I don't want to get the warning. I know I can switch it off but there are
> >other warnings I would like to see.
> --------------------[snip]--------------------
>
> Just to omit the warning, you may use the silent-error notation
> @fopen($url, 'r');
> but this will always work unless the host portion of the URL cannot be
> resolved.
Another alternative is to look into the track_errors INI directive which
will populate the $php_errormsg variable with the last error that
occurred... in that case something like the following could be done:
$fr = @fopen("http://www.coggeshall.org/myfile.php",'r');
if(!$fr) {
echo "The error that occurred was $php_errormsg";
// Do test on the error message here
}
Although that won't be absolutely full-proof (since there is no absolute
which says that the error message "failed to open stream: HTTP request
failed! HTTP/1.0 404 Not Found" is going to be identical in new PHP
versions) it is an option to consider.
John
--
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
John Coggeshall
john at coggeshall dot org http://www.coggeshall.org/
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php