Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    188
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Detecting Broken Links

    HI

    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?

    Thanks

    EDIT** What im asking is is there a way to get the responce code for a url using php?
    Last edited by thekevin07; 06-01-2007 at 08:11 PM.

  • #2
    New Coder
    Join Date
    Sep 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

    Code:
    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!

  • #3
    Regular Coder
    Join Date
    Dec 2006
    Posts
    188
    Thanks
    17
    Thanked 0 Times in 0 Posts
    thanks that works perfect


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •