so I have the code
function getTagContent($string, $tagname) { $pattern = \"/<$tagname.*?>(.*)<\\/$tagname>/\"; preg_match($pattern, $string
try DOM
$url = "http://www.freakonomics.com/2008/09/24/wall-street-jokes-please/"; $doc = new DOMDocument(); $dom = $doc->loadHTMLFile($url); $items = $doc->getElementsByTagName('title'); for ($i = 0; $i < $items->length; $i++) { echo $items->item($i)->nodeValue . "\n"; }