Html Parser for PHP e.g. Java

I develop Java programs that parse the HTML code of web pages using various html parsers such as Jericho, NekoHtml, etc.

Now I want to develop parsers in the PHP language. Therefore, before starting, I want to know that there are html parsers available that I can use with PHP to parse html code

+3
source share
3 answers

Check out the DOMDocument .

Example # 1 Creating a document

<?php
$doc = new DOMDocument();
$doc->loadHTML("<html><body>Test<br></body></html>");
echo $doc->saveHTML();
+2
source

The built-in DOM parser class does a very good job. There are many other xml parsers .

+2
source

DOM . , , HTML HTMLPurifier - , DOM.

+1

Source: https://habr.com/ru/post/1733208/


All Articles