RE: [PHP] Broken links report

From: Date: Tue, 03 Jun 2003 08:42:44 +0000
Subject: RE: [PHP] Broken links report
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-149896@lists.php.net to get a copy of this message
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/ -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-

« previous php.general (#149896) next »