Menu
Hi, I have been trying extract the title from html pages, i’m surprised that there isn’t a function to do this in a similar way that get_meta_tags gets descriptions and keywords. Anyway i’ve used regex to search for the title tags but i can’t get the title content into a variable. Can anyone see where i’m going wrong?
code:-
$URL = $_GET[‘url’];
$page = file_get_contents(“$URL”);
preg_match_all( “/<title>([a-z 0-9]*)</title>/”, $page, $matches );
$title = $matches[0][0];
echo $title;