Html what I am grabbing looks like this
<div id="table"><table>
<tr><td>Clubname</td><td>15</td><td>30</td></tr>
<tr><td>Clubname 2</td><td>15</td><td>30</td></tr>
<tr><td>Clubname 3</td><td>15</td><td>30</td></tr>
</table></div>
What i want is to find the tr where Clubname 2 is in and get the data from td[1] and td[2] and output this.
I want this done with simple_html_dom.php
What I already have is
require('simple_html_dom.php');
$html = file_get_html('webpage.html');
foreach($html->find('div#table') as $e)
echo $e->innertext . '<br>';
How to find the specific clubname and get the specific content from the td's from same tr?
=================================================================================
Okay thanks, what I did now is like you told me, only with variable, because later I want to use a variable.
<?php
$clubname = 'Ajax';
require('phpQuery/phpQuery.php');
$result = array();
$limit = 2; //you need only the next two sibling
$dom = phpQuery::newDocumentFile('http://soccer.gijsve.nl/test2.php');
$match = $dom->find('td:contains("'.$clubname.'")');
while( 0 < count( $match = $match->next() ) && ( 0 < $limit-- ) ){
$result[] = $match->text();
}
var_dump($result);
?>
What I want now is to select the first td (td before the match) and the fourth and fifth for example. Because I need to know the scored goals, the points and the rank. See http://soccer.gijsve.nl/test2.php for the table I am grabbing.