I'm trying to extract data from HTML code in a PHP variable.
The HTML is the following:
<tr class="tr1">
<td align="right">
1.
</td>
<td align="left">
<input type="hidden" name="now[8116632]" value="98" />
<input type="hidden" name="add[8116632]" value="39" />
<input type="hidden" name="sec_value[8116632]" value="45720000" />
<div id="uid8116632"></div>
</td>
<td align="left">
<a href="playerInfo.phtml?pid=8116632" target="_blank"
onclick="return(openSmallWindow('playerInfo.phtml?pid=8116632',
c41c569a1b9c46c4cbc4bc58f37cb05f'))">kana</a>
</td>
<td align="right">
98
</td>
<td align="right">
45.720.000
</td>
</tr>
<tr class="tr2">
<td align="right">
2.
</td>
<td align="left">
<input type="hidden" name="now[8121292]" value="90" />
<input type="hidden" name="add[8121292]" value="45" />
<input type="hidden" name="sec_value[8121292]" value="36500000" />
<div id="uid8121292"></div>
</td>
<td align="left">
<a href="playerInfo.phtml?pid=8121292" target="_blank"
onclick="return(openSmallWindow('playerInfo.phtml?pid=8121292',
'c41c569a1b9c46c4cbc4bc58f37cb05f'))">Xoán Manuel Pérez Chaves</a>
</td>
<td align="right">
90
</td>
<td align="right">
36.500.000
</td>
</tr>
In this code I want to extract:
<td align="right">1.</td>
This number as $position
<input type="hidden" name="now[8116632]" value="98" />
The idnumber which is between square bracks in attributte name as $id, the value as $value
<input type="hidden" name="sec_value[8121292]" value="36500000" />
This value as $price
My php code so far is this:
$DOM = new DOMDocument;
$DOM->loadHTML($result2);
$xpath = new DomXpath($DOM);
$div = $xpath->query('//*[@class="tr1"]');
Now how can I get the variables I tell you guys before? $position,$id,$value and $price
Thank you in advance