I'm grabbing a page with PHP's cURL and the page contains an arbitarty set of <td> elements in a <table class="content"> how do I use the xpath to traverse to the content class and said td's and match a string, invoke that <td>'s <a href>. I'm just not sure how to set up the xpath and how to search the elements and invoke the a href.
So..
the page I parse contains:
this is what i have so far:HTML Code:-<table class="content"> --<tbody> ---<tr> -----<td> -----<td> -----<td> -----<td> ---<tr> -----<td> -----<td> ------<a href THIS IS WHAT I NEED TO GRAB IF IT MATCHES> ------<br> ------<b>THIS IS WHAT I NEED TO SEARCH FOR A MATCH</b> ------<br> ------Text ------<br> ------<br> -----<td> -----<td> -----<td>
any help would be appreciated or direction to a really great in-depth xpath or html document parsing guidePHP Code:$doc = new DOMDocument();
$doc->loadHTML( $rawPage );
$xpath = new DOMXPath( $doc );
$queryResult = $xpath->query( "" );
foreach ( $queryResult as $result )
{
echo $result->textContent;
}




Reply With Quote
