I need to get only the first columns of all rows from a table using Simple Html Dom. How I do this?
foreach($html->find('table.horarios-filmes-single tr') as $tr) {
foreach ($tr->find('td', 1) as $element) {
echo $element->plaintext . '<br>';
}
}
This returns the error:
This should help you with your problem,
$e = [];
foreach($html->find('table.horarios-filmes-single tr') as $tr) {
$e[] = $tr->find('td', 0);
}
0 index will give you first instance of
td
in everytr
If still face any problem, you should print_r($html->find('table.horarios-filmes-single tr'));
and check if you are getting any data.