codice:function check_url($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $headers = explode("\n", curl_exec($ch)); curl_close($ch); $response = rtrim($headers[0]); if ( !preg_match('/HTTP.*? (\d+)/', $response, $match) ) return FALSE; if ( $match[1] == 200 ) return TRUE; return FALSE; } var_dump(check_url('http://www.html.it/')); var_dump(check_url('http://www.html.xx/'));