...

View Full Version : How to detect a broken/timed out link?



XmisterIS
06-29-2010, 10:36 AM
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.

xconspirisist
06-29-2010, 01:29 PM
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

alstonwillman
06-30-2010, 12:00 PM
For this purpose you use software Xenu Link Sleuth.This software is very benifical for your website



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum