Invece di __FILE__ potresti usare anche $_SERVER['SCRIPT_FILENAME']Codice PHP:
$data=file_get_contents(__FILE__);
if(preg_match("/<title>(.+)</title>/i", $data, $m)) print "The title of $url is [b]$m[1]";
else print "The page doesn't have a title tag";