I want to scrape html with php and retrieve the js onclick url from specific table cells, the cells are always in identical pairs so I only need one url of every pair, for example:
<tr>
<td width='10' class='score' OnClick="window.location='page.99.html'">
<td width='10' class='score' OnClick="window.location='page.99.html'">
</tr>
I want to retrieve page.99.html from either these and carry on for however many pairs there are. I've been using this and can get the cell value but not the onclick propery:
$dom = new DOMDocument();
$res=$dom->loadHTML($html);
$xpath = new DomXPath($dom);
$cells = $xpath->query( '//td[@width="10"]');
foreach($cells as $cell) {
echo $cell->nodeValue;
}
Can anyone please tell me how to access this onclick url for each appropriate cell?