Reputation: 4510
If I have an HTML document, what is the best way to go through the document and gather the href values from all anchor tags with a particular class using PHP?
Upvotes: 0
Views: 1495
Reputation: 317177
See soulmerge's answer to "Preg_match_all href". Adjust the XPath to
//a[@class="foo"]/@href
to get a DOMNodeList of all href attributes belonging to elements with a class of foo
.
Upvotes: 2