I used a small script that attempts to connect to the website through a socket. I simply set the default timeout of the access-attempt to 10 seconds, and when the timeout was reached, I stated the url as invalid:
PHP Code:
/**
* Checks if the entered url links to a valid website.
* A valid website is one that responses within a timelimit of <code>$seconds</code>
*
* @param string The url that need to be checked
* @param integer The number of seconds before a timeout occurs. default=10
* @return boolean True if the website responded, false otherwise
*/
function isValidWebsite ($url, $seconds=NULL) {
$realUrl = preg_replace ('#https?:\/{2}([^\/\\]+).*?#s', '\\1', $url);
$seconds = is_null ($seconds)? 10 : $seconds;
return fsockopen ($realUrl, 80, $errNo, $errStr, $seconds);
}
There might be some easier ways, but this one has worked fine for me