Class DOMDocument does not contains method getElementsByClassName
Use xpath
$xpath = new DOMXpath($dom);
$xpath->query('//div[contains(@class, "localImage")]'); //instance of DOMNodeList
Related Contents:
- Remove a child with a specific attribute, in SimpleXML for PHP
- Simplify PHP DOM XML parsing – how?
- How to extract a node attribute from XML using PHP’s DOM Parser
- Getting node’s text in PHP DOM
- How do you parse and process HTML/XML in PHP?
- How to get innerHTML of DOMNode?
- Parse XML with Namespace using SimpleXML [duplicate]
- How to generate XML file dynamically using PHP?
- Best XML Parser for PHP [duplicate]
- A simple program to CRUD node and node values of xml file [closed]
- How to convert XML into array in PHP?
- Simple XML – Dealing With Colons In Nodes
- How to use XMLReader in PHP?
- Getting DOM elements by classname
- How to return outer html of DOMDocument?
- PHP convert XML to JSON
- Forcing a SimpleXML Object to a string, regardless of context
- Parsing Huge XML Files in PHP
- PHP: How to handle
- PHP XML how to output nice format
- How to resolve cURL Error (7): couldn’t connect to host?
- How to get the value of an attribute from XML file in PHP?
- How to insert HTML to PHP DOMNode?
- Implementing condition in XPath [duplicate]
- PHP namespace simplexml problems
- Error: “Input is not proper UTF-8, indicate encoding !” using PHP’s simplexml_load_string
- SimpleXML and print_r() – why is this empty?
- Simple HTML Dom: How to remove elements?
- How do I capture PHP output into a variable?
- PHP library for parsing XML with a colons in tag names? [duplicate]
- SOAP PHP fault parsing WSDL: failed to load external entity?
- How to check if string is a valid XML element name?
- Is there any way to convert json to xml in PHP?
- Remove empty tags from a XML with PHP
- Best way to transfer an array between PHP and Javascript [duplicate]
- How to convert SOAP response to PHP Array?
- Using SimpleXML to read RSS feed
- Accessing @attribute from SimpleXML
- preg_match(); – Unknown modifier ‘+’ [duplicate]
- Generating XML document in PHP (escape characters)
- DOM parser that allows HTML5-style
- Best way to process large XML in PHP [duplicate]
- Is htmlentities() sufficient for creating xml-safe values?
- format xml string
- What is the fastest XML parser in PHP?
- php count xml elements
- PHP – Processing Invalid XML
- Merge XML files in PHP
- How to retrieve comments from within an XML Document in PHP
- Rationale behind SimpleXMLElement’s handling of text values in addChild and addAttribute