php - Get contents of BODY without DOCTYPE, HTML, HEAD and BODY tags -
what trying include html file within php system (not problem) html file needs usable on own, various reasons, need know how can strip doctype, html, head , body tags in context of php include, if that's possible.
i'm not particularly @ php (doh!) searches of php manual , on web hasn't made me figure out. meaning or reading tips, or both, appreciated.
since substr()
method seemed swallow, here dom parser method:
$d = new domdocument; $mock = new domdocument; $d->loadhtml(file_get_contents('/path/to/my.html')); $body = $d->getelementsbytagname('body')->item(0); foreach ($body->childnodes $child){ $mock->appendchild($mock->importnode($child, true)); } echo $mock->savehtml();
anybody wish see "other one", see revisions.
Comments
Post a Comment