Reputation: 15378
I have some html input from the user, I want to find all occurences of
<span class="widget-tag"></span>
This is what I have so far:
$d = new DOMDocument();
$d->loadHTML($html);
I don't know which function to use next.
Any help would be great.
Thanks
Jason
Upvotes: 0
Views: 158
Reputation: 10678
After that try...
$xpath = new DOMXpath($d);
$elements = $xpath->query("//div[class='widget-tag']");
This will return a DOMNodeList of the matching elements.
Upvotes: 2