Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hook_body($obj)
- {
- echo "<h1>START</h1>";
- $doc = new DOMDocument();
- libxml_use_internal_errors(true);
- $doc->loadHTML($obj); // loads your html
- $xpath = new DOMXPath($doc);
- // select all pre tags with attributes
- $nodelist = $xpath->query("//pre[@*]");
- // iterate through selected nodes and print them
- for($i=0; $i < $nodelist->length; $i++) {
- $node = $nodelist->item($i);
- echo $node->nodeValue; //var_dump($node->nodeValue);
- }
- echo "<h1>END</h1>";
- echo $obj;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement