Reputation: 15
Looks like I need to use $e->first_child ()
and $e->lastChild ()
, but its not working.
require_once '/simple_html_dom.php';
$html = file_get_html('http://example.com');
$table = $html->find('table');
echo $table->first_child();
<table>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table
Upvotes: 1
Views: 1077
Reputation: 428
use this:
$table->find('tr',0);//first one
$table->find('tr',-1);//last one
if not works:
$html->find('tr',0);//first one
$html->find('tr',-1);//last one
Upvotes: 2