I have a particular problem which I can't crack. I searched for every tutorial or form entries, but had no luck in succeeding in what I need to do. So my HTML file:
<html>
<head>**SOMETHING HERE**</head>
<body>
<div>
<table>
<thead>
<tr><th>TEXT/NUM IS HERE</th><th>TEXT/NUM IS HERE</th><th>TEXT/NUM IS HERE</th></tr>
</thead><tbody>**SOMETHING HERE**</tbody></tfoot>**SOMETHING HERE**</tfoot>
</table>
</div>
</body>
</html>
What I need is to go through every tag (th) in the "thead=>tr" tag and record the value between these "th" tags into an array;
For this I was planning to use DOMDocument and DOMXPath.
There was many ways I tried to solve this issue, but most found one online was:
$file = "index.html";
$dom = new DOMDocument();
$dom->loadHTMLfile($file);
$thead = $dom->getElementsByTagName('thead');
$thead->parentNode;
$th = $thead->getElementsByTagName('th')
echo $th->nodeValue . "\n";
But I'm still getting many errors and can't find a way to do this. Is there any way of doing this nice end simple and of course foreach element in the parent element.
Thank you.