I want to fetch any meta, title, script, link tag that is available on HTML page, this is the program i write (not correct but will give idea for experts).
<?php
function get_tag($tag_name, $url)
{
$content = file_get_contents($url);
// this is not correct : regular expression please //
preg_match_all($tag_name, $content, $matches);
return $matches;
}
print_r(get_tag('title', 'http://stackoverflow.com'));
?>
Output should come something like this :
Array
(
[0] => title
[1] => Stack Overflow
)
Thanks!!