function url_exists($url) { @ $headers = get_headers($url); return preg_match('/^HTTP\/\d\.\d\s+(200|301|302)/', $headers[0]); }