Question

Allow me to explain what i need after the set of code

           <tr>
<td align="center"><a href="search.asp?keyword=1123">1123</a></td>
<td> </td>
<td> </td>
<td> </td>
<td align="center"><a href="member.asp?t_id=75481&amp;t=0"></a> TEXT</td>
          </tr>

There are multiple Rows I'm trying to CURL, the link on the last t_id=75481 , is actually the ROW number. I would like to extract it based on the first

example as below

IF first = NUMBER(1123) , retrieve the number 75481 (aka CLICK in CURL).

What i'm doing here is trying to click/submit(CURL) on a text that contains the row number but i have to do that based on the comparison of my number to the first

I'm using PHP Simple HTML DOM Parser in SourceForge.It Seems limited to what i can do at times, in fact when i use it to extract some data , it doesn't seem to be able to take in enough "Conditions" which lead me to extracting the correct data half the time because website changes for different page(it does, depends on the content)

1) I would need a suggestion to get the row ID so i can CURL(act as a CLICK) 2) Any other HTML DOM you would suggest? I feel restricted or i'm just noob :x

thanks in advance!

Was it helpful?

Solution

You can use DOMDocument and XPath together to achieve what your trying to accomplish.

$doc = new DOMDocument();
$doc->loadHTMLFile($htmlfile);

$xpath = new DOMXpath($doc);
$elements = $xpath->query("//table/tr/1");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top