PHP Simple HTML DOM Parser does not handle invalid HTML - stuck in first try

I am trying to select either a class or an identifier using PHP Simple HTML DOM Parser with absolutely no luck.

My example is very simple and seems to match the examples given in the manual
(simplehtmldom.sourceforge AT net / manual.htm), but it just doesn't work,
it pushes me against the wall.
Other sample scripts defined with a simple dom work fine.

See an example: link text. This is the simplest example that I found ... How to parse it?

Should I do this with Perl - An example HTML page is not valid HTML.
I don’t know if Simple HTML DOM Parser handle a badly distorted HTML file (maybe not).

Good: if I can’t get it working, I can try some Perl parsers, for example HTML::TreeBuilder::XPath

+4
source share
1 answer

Use Tidy to clear malformed HTML before parsing it using the PHP DOM parser.

http://www.php.net/manual/en/tidy.examples.basic.php

+4
source

All Articles