I am using the php-html-parser package (based simplehtmldom) loaded in via Composer and parsing an HTML string, however when using the $dom->find() to loop through all of the elements I am searching for, it is only detecting the first element (out of 29).
require __DIR__ . "/vendor/autoload.php";
$dom = new PHPHtmlParser\Dom;
$dom->load($result); // $result is the output of a cURL request
$classes = $dom->find('li[class=SPECIALCLASS]');
echo count($classes);
foreach($classes as $class){
echo $class->text;
}
Output: 1
Sample HTML:
<li class="SPECIALCLASS "></li>
<li class="SPECIALCLASS SOMEOTHERCLASS "></li>
EDIT: Dropping the class selector completely results in 5/29 li tags being returned, so I have a feeling there is something bigger at play here.