*/
function html_extract_title($html)
{
- if (preg_match('!<title>(.*)</title>!is', $html, $matches)) {
+ if (preg_match('!<title>(.*?)</title>!is', $html, $matches)) {
return trim(str_replace("\n", ' ', $matches[1]));
}
return false;
$title = 'Read me please.';
$html = '<html><meta>stuff</meta><title>'. $title .'</title></html>';
$this->assertEquals($title, html_extract_title($html));
+ $html = '<html><title>'. $title .'</title>blabla<title>another</title></html>';
+ $this->assertEquals($title, html_extract_title($html));
}
/**