Grab remote page’s title

Posted on: October 7, 2010 Posted by: JJ Comments: 0

Grab remote page’s title

Ever wonder how you can grab remote page’s title?

Here’s how:

[php]
function get_page_title($url){
oif( !($content = @file_get_contents($url)) ) return false;
oif( preg_match(‘/<title>(.*?)<\/title>/imsxe’, $content, $match)) {
oreturn trim($match[1]);
o} else {
oreturn false;
o}
}
[/php]