View Full Version : Detecting Broken Links

06-01-2007, 07:34 PM

I have a list of user submitted links that i need a way to check to see if they are working and dont throw an object not found or 404 Error does anyone know how to do this with PHP?


EDIT** What im asking is is there a way to get the responce code for a url using php?

06-01-2007, 08:21 PM
Just use CURL, fetch the header, then look at the status line. There are a few 50* type errors that may not mean the page is not there, it could be the server is to busy or there maybe a error in the code. So be careful when removing those types links!

array (
200 => 'OK',
202 => 'Accepted',
302 => 'Found',
304 => 'Not modified',
307 => 'Temporary redirect',
500 => 'Internal server error',
503 => 'Service unavailable',

200, 202, 302, 304 (ok page)
307, 500, 503 (ok page) but flag it, so if the next time you check it (interval checking, [monthly]), it returns the same thing, then remove it or update the link if it's a redirect type error!

06-04-2007, 02:52 AM
thanks that works perfect