PHP 获取网页title

 <?php 
$url = 'http://sohu.com'; 
$lines_array = file($url); 
echo $lines_array;
echo "<br/>";
$lines_string = implode('', $lines_array);  
eregi("<title>(.*)</title>", $lines_string, $head);
echo "head:".$head; 
echo "<br/>";
print_r($head);
echo "<br/>"; 
echo "title:".$head[1];
 
?>

你可能感兴趣的:(PHP 获取网页title)