I can get all image elements in the DOM like this:
$element->getElementsByTagName('img')
How can I get all image and iframe elements in the DOM in one request? Something like:
$element->getElementsByTagName('img, iframe')
I can get all image elements in the DOM like this:
$element->getElementsByTagName('img')
How can I get all image and iframe elements in the DOM in one request? Something like:
$element->getElementsByTagName('img, iframe')
Using getElementsByTagName you cannot get multiple elements by tag name. You can get one tag at a time only. To achieve this, there are two ways
Calling Tag for two times
$element->getElementsByTagName('img')
$element->getElementsByTagName('iframe')
OR
Using JavaScript
document.querySelectorAll('img,ifame')
PS: I would not recommend using PHP for DOM parsing because that will impact page performance.
Hope this helps