Answer the question
In order to leave comments, you need to log in
What is the best way to parse an HTML page? DOM, preg_math or something else?
In fact, a template engine is needed ... it is understood that a certain php script will output data in HTML format, after parsing the template and inserting the necessary data ... There are a lot of descriptions of various technologies on the network, but each has its drawbacks and each is not advised use!
Answer the question
In order to leave comments, you need to log in
These are all third-party libraries, I somehow already used them ... if you do not use a third-party one, but limit yourself to regular php tools?
Do you understand your task? I will write what I understood from your confusion:
Am I missing something? If not, what didn't you like about bare PHP? It's like a template engine.
In general, I divide the process into several stages.
I get a page.
through str_pos and substr I get the desired section of the page, restore it through tidy_repair_string ,
and then something like the condition if (!preg_match(...)) { $dom new DomDocument(); ... } here's a diagram...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question