=200 && $httpcode<400 ) return 2; else if ( $httpcode >= 400) return $httpcode; else return 0; } function sanitizeUrl($url){ if ( ! preg_match("|^[a-zA-Z]+://|", $url) ) $url = "http://" . $url; if ( preg_match("|^(?[a-zA-Z]+://(.+\.[a-zA-Z]+){1,})/.*|", $url, $match) ) $url = $match["host"]; return $url; }