I wonder if there is any good PHP script (libraries) to check if link are broken? I have links to documents in a mysql table and could possibly just check if the link leads to a the document, or if I am redirected to anther url. Any idea? I would prefer to do it in PHP.
Might be related to: Check link works and if not visually identify it as broken
You can check for broken link using this function:
You need to have
CURL
installed for this to work. Now you can check for broken links using:Also check this link for HTTP status codes : HTTP Status Codes
I think you can also check for
301
and302
status codes.Also another method would be to use
get_headers
function . But this works only if your PHP version is greater than 5 :In this case just check the output :
Hope this helps you :).