Hello and welcome to our community! Is this your first visit?
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
    Jun 2010
    Thanked 8 Times in 8 Posts

    How to detect a broken/timed out link?

    I'd like to write a piece of code that automatically detects broken or timed out links on my website (I'm thinking of a CRON job that runs a PHP script to do it).

    My chosen solution is, briefly, as follows:

    1) Consult a list of links that I know are present on my site.
    2) Use cURL to try to visit each one.
    3) Detect any broken or timing out links.
    4) Automaticaly email me with details if any links are broken or timing out.

    I know how to do steps 1, 2 and 4 ... but not 3! Any ideas? Is there anything reliable in the HTTP header that I can use?

    Many thanks.

  • #2
    Regular Coder xconspirisist's Avatar
    Join Date
    Jun 2006
    Great Britain.
    Thanked 6 Times in 6 Posts
    Have you seen curl_setopt? You can set the connect time out as a cURL option.

    Manual page here: http://uk.php.net/manual/en/function.curl-setopt.php the option that may be of interest is: CURLOPT_CONNECTTIMEOUT
    If I have been helpful, use the "thank" button - It makes me happy!

    xconspirisist.co.uk - homepage of my online alias
    technowax.net - a community for people interested in all forms of modern technology.

  • #3
    New to the CF scene
    Join Date
    Jun 2010
    Thanked 0 Times in 0 Posts
    For this purpose you use software Xenu Link Sleuth.This software is very benifical for your website


    Posting Permissions

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