parse html dom php code example
Example: php parse html
$dom = new DOMDocument();
$dom->loadHTMLFile('path/to/htmlfile.html'); // or loadHTML($str)
$dom->load('path/to/xmlfile.xml'); // or loadXML($str)
$table = $dom->getElementById('mytable-id'); // DOMElement
$lines = $table->getElementsByTagName('tr'); // DOMNodeList
$links = $dom->getElementsByTagName('a');
$xpath = new DOMXpath($dom);
$tables = $xpath->query("//table[contains(@class,'mytables-class')]");