I do not develop in PHP as often as most of you, so I am hoping that someone might help me with this, as I am not sure that this is the best way to go about it. I am trying to remove ALL information in the HEAD of the HTML page, as well as the BODY tag and closing BODY & HTML tags. Here is what I am attempting to do:
Code: Select all
# $FileText is the HTML content loaded into a variable
# remove any HTML body and header information for rewrite
if(ereg("(<body[^>])",$FileText,$BodyMatch)){
$arrFileText = explode($BodyMatch[1],$FileText);
$FileText = str_replace('</body>','',$arrFileText[2]);
$FileText = str_replace('</html>','',$FileText);
}
# here I would use $FileText to do the rest of my needed work
Is this a consistent and/or viable approach? This has not gone through extensive testing yet, but seems to be working so far.