I am after php code which does... 1. Validate URL. 2. Check URL if really exists 3. Pull the <title> from the given URL how do i do this?
function fetch_title($url) { if (!preg_match('~^https?://~i', $url)) { trigger_error('Invalid URL given in ' . __FUNCTION__, E_USER_NOTICE); return false; } if (!$content = @file_get_contents($url)) { return false; } else if (!preg_match('~<title>(.*?)</title>~si', $content, $title)) { return false; } return $title[1]; } PHP: