How can I take all the attribute of an element? Like on my example below I can only get one at a time, I want to pull out all of the anchor tag's attribute.
$dom = new DOMDocument(); @$dom->loadHTML(http://www.example.com); $a = $dom->getElementsByTagName("a"); echo $a->getAttribute('href');
"Inspired" by Simon's answer. I think you can cut out the
getAttributecall, so here's a solution without it: