<div class="listing-new type-standard">
<a href="/someLink" class="link-block cfix"data-eventaction="ListingOpened">
<div class="content-wrap">
<p>testing</p>
</div>
</a>
</div>
I tried to parse the code above using both in-built dom functions and the simple_html_dom_parser. Unfortunately, I could not succeed in with Simple Html Dom Parser. It doesn't find anything.
SimpleHtmlDomParser way
foreach($html->find('a[data-eventaction]') as $element){
echo $element->href . "
";
}
Normal DOM way which worked
$xpath = new DOMXPath($dom);
$list = $xpath->query("//a[@data-eventaction=ListingOpened]");
I believe the reason simple parser doesn't work is the attribute "data-eventaction" doesn't have a space before it. Because, If I add space, it also works.
Any quick solutions?