<?php
$url=”http://example.com”;
echo getTitle($url);
function get_page_title($url)
{
if( !($data = file_get_contents($url)) ) return false;
if( preg_match(“#<title>(.+)</title>#iU”, $data, $t)) {
return trim($t[1]);
}
else
{
return false;
}
}
?>