$url = "http://google.com"; $data = preg_replace('/\s+\s+/','',file_get_contents($url)); preg_match('/<title>(.*)<\/title>/',$data,$title); echo $title[0];