try this:
$URL = "http://www.yahoo.co.uk";
$open = fopen("$URL", "r");
if(!$open){
die("Could not open file");
}
$got_file = fread($open, 20000);
fclose($open);
$start = '<title>';
$end = '</title>';
$data = eregi("$start(.*)$end", $got_file, $out);
$title = str_replace($start, "", $out[0]);
$title = str_replace($end, "", $title);
$title = trim($title);
echo $title;