I\'m trying to parse HTML from loadHTML but I\'m having trouble, I managed to loop through all
DOMElement also supports getElementsByTagName:s in the document but I don\'t know how to loop through
$DOM = new DOMDocument();
$DOM->loadHTMLFile("file path or url");
$rows = $DOM->getElementsByTagName("tr");
for ($i = 0; $i < $rows->length; $i++) {
$cols = $rows->item($i)->getElementsbyTagName("td");
for ($j = 0; $j < $cols->length; $j++) {
echo $cols->item($j)->nodeValue, "\t";
// you can also use DOMElement::textContent
// echo $cols->item($j)->textContent, "\t";
}
echo "\n";
}