1$dom = new DOMDocument();
2$dom->loadHTMLFile('path/to/htmlfile.html'); // or loadHTML($str)
3$dom->load('path/to/xmlfile.xml'); // or loadXML($str)
4
5$table = $dom->getElementById('mytable-id'); // DOMElement
6$lines = $table->getElementsByTagName('tr'); // DOMNodeList
7$links = $dom->getElementsByTagName('a');
8
9$xpath = new DOMXpath($dom);
10$tables = $xpath->query("//table[contains(@class,'mytables-class')]");