Urgent problem PCRE or DOM help
| From: | Lenin | Date: | Wed, 13 May 2009 03:23:57 +0000 |
| Subject: | Urgent problem PCRE or DOM help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-292517@lists.php.net to get a copy of this message | ||
<td class="text11">
<a href="some url"><img ></a><br><hr>
<a href="some url">Home</a> | <b>My Interface</b><br>
<br>
<h1 style="color:303030;">My Interface</h1><br>
<table>DONT READ TABLE</table><br>
<b><u>Step-By-Step Instructions:</u></b><br><br>
P tags
IMG tags
<table><tr><td><table>DONT
READ</table></td></tr></table><hr>
</td>
I am having trouble with the above HTML semantics. I just need to read the
content inside the TD with Class name text11(its the only class in the page
as well).
Need to omit the table inside as it contains Adsense ads.
Got to omit the first two A HREF tags as well. I'm not very good with PCRE
so failing to make it work.
Tried with DOMDocument but with the examples found I failed to achieve the
result.
$elements = $doc->getElementsById('table');
if (!is_null($elements)) {
foreach ($elements as $element) {
echo "<br/>". $element->nodeName. ": ";
$nodes = $element->childNodes;
foreach ($nodes as $node) {
echo $node->nodeValue. "<br/>";
}
}
}
This above code only gets Texts inside but not Img.
Plz any help would be greatly appreciated.