loadHTML($html); return Qs_Dom::getTextFromNode($document); } public static function getTextFromNode(DOMNode $node) { $text = ''; if ($node instanceof DOMText) { return $text . $node->textContent; } $node = $node->firstChild; if ($node != null) { $text .= Qs_Dom::getTextFromNode($node); } while ($node->nextSibling != null) { $text .= Qs_Dom::getTextFromNode($node->nextSibling); $node = $node->nextSibling; } return $text; } }