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
As quick workaround check, you can use the global variable $http_response_header with file_get_contents() function.
For example (extracted from PHP documentation):
Then check the status code in first line for a "HTTP/1.1 200 OK" or other HTTP status codes.