Answer the question
In order to leave comments, you need to log in
Why doesn't the first example from the PHP HTML Parser documentation work?
I installed PHP HTML Parser via Composer, I'm doing the first example from the documentation - nothing is displayed.
require 'vendor/autoload.php';
use PHPHtmlParser\Dom;
$dom = new Dom;
$dom->load('<div class="all"><p>Hey bro, <a href="google.com">click here</a><br /> :)</p></div>');
$a = $dom->find('a')[0];
echo $a->text; // click here
Answer the question
In order to leave comments, you need to log in
I do not recommend using this library. I didn’t find any documentation except on the main page of the project or didn’t look for it well. Therefore, you can only guess about its capabilities. I read that there is a lib inside and she doesn’t know how to search by attributes, which, in principle, is not described in the docks.
I personally tried to use this library. As a result, I spat and went back to Simple HTML DOM
simplehtmldom.sourceforge.net
For 4 years now, the library has not been updated, but supports all perverted content search methods.
Simple as a stick and excellent documentation. For PHP this is probably a must have.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question