tracking HTTP errors

From: Date: Fri, 14 Jul 2000 15:41:30 +0000
Subject: tracking HTTP errors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6660@lists.php.net to get a copy of this message
Hello All, Anyone know how I can track the response codes from an HTTP connection? i.e.: -- <?php $line=0; // this file does not exist $file = @fopen("http://someserver.com:8000/test/fopen_dtest.txt", "r"); if (!$file) { echo "<p>Unable to open remote file.\n"; echo "<p>php-error: $php_errormsg\n"; echo "<p>file: $file\n"; exit; } while (!feof($file)) { echo "#$line: ~" . fgets($file, 1024) . "~<p>"; $line++; } fclose($file); ?> --Prints out: Unable to open remote file. php-error: fopen("http://ralph.yourfit.com:8000/~scotte/test/fopen_dtest.txt","r") - Success file: --- That file is not there, so why does php_errormsg state Success? How do I get back the return codes from the HTTP request, i.e.: NOT_FOUND (404) should have been returned since the test file is not there. Thanks! Blessings, -Scott

« previous php.general (#6660) next »