so im trying to grab the headers from html. this is what i got so far preg_match('/<head>(.*?)<\/head>/', $html,$res)) but it doesnt work for multiple lines. whats up?
Try adding a modifier s to the end of your regular expression: preg_match('/<head>(.*?)<\/head>/s', $html,$res)) http://php.net/manual/en/reference.pcre.pattern.modifiers.php
..and you will get only the meta tags, nothing else. get_headers is completely the wrong way to go, that will give you http servers header, not the headers from html. if (preg_match('%<HEAD[^>]*>(.*?)</HEAD>%six', $subject, $regs)) { $result = $regs[1]; } else { $result = ""; } Code (markup):