I have one html page where there are number of <tr><td>
elements like
<tr>
<td class="notextElementLabel width100">address:</td>
<td style="width: 100%" colspan="1" class="formFieldelement"><b>12284,CA</b></td>
</tr>
let say the above <tr>
is at 4th position means before this elements there are 3 more <tr>
Now I want to get the value of address
so I am doing
$doc = new DOMDocument();
@$doc->loadHTML($this->siteHtmlData);
$tdElements = $doc->getElementsByTagName("td");
$i=0;
foreach ($tdElements as $node) {
if(trim($node->nodeValue) == 'address:'){
echo "
got it
";
}else{
echo "
---no ---
";
}
}
How can I get the value of "12284,CA". Please guide.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…