On Wed, 2003-12-31 at 12:44, Matthew Macdonald-Wallace wrote:
> how about building on this:

I'm gonna take it one step further.  How about having an array of the
error codes you _Don't_ want, i.e:

500 Internal Server Error
404 Document Not Found
301 Moved Permanently 
302 Moved Temporarily 
403 Forbidden
204 No Content 
etc...

The adding them into the code as follows:

> // try and open the link
> $file = fopen($link,"r"); // Note if safe mode is on, fopen might not
>                         //open URLs
> 
> // Look for any error in the code

// set up the array with errors in it
$errorArray = array("404","500","401","...");

// Count the number of values in the array
$arrayCount = count $errorArray

// loop through the opened URL looking for the error code
for($i = 0;$i <= $arraycount;$i++)
{
> eregi($file, $errorArray[$i],$errorCode) // greps the file looks for the text
>                                        // of the error code and puts it into an array
> 
> // check to see if the array holds data
> if($errorCode) // if this is TRUE, the file does not exist
>       {
>               echo "there has been an error";
>               exit;
>       }
> else
>       {
>               // Code to add to database
>       }
>       // End If Statement
}
// End For Loop

Again, this has not been tested, so can't promise anything!

HTH,

Matt
--
+----------------------------------+
|Matthew Macdonald-Wallace         |
|The Truth Will Set you Free       |
|http://www.truthisfreedom.org.uk/ |
+----------------------------------+
"Putting Education First." George W. Bush's Presidential Campaign
website July 2000 The presidential candidate's web site gave a priority
ranking to important issues of concern to the governor. "Putting
Education First" was ranked No. 3 on the list.

____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set 
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to