How do I cut out only the first <tr class="ismResult">
and <tr class="ismFixtureSummary">
in this, but not the second set?
I am looking to cut out only the first two <tr>
tags and contents. Is there a way to set both of these to a variable eg, $Result
? I'm looking to keep the html as part of it.
<table>
<tbody>
<tr class="ismResult">
<td>2-0</td>
</tr>
<tr class="ismFixtureSummary">
<td>Player1</td>
<td>Player2</td>
</tr>
<tr class="ismResult">
<td>1-1</td>
</tr>
<tr class="ismFixtureSummary">
<td>Player3</td>
<td>Player4</td>
</tr>
</tbody>
</table>
WHAT I'VE TRIED:
include('simple_html_dom.php');
$url = 'http://www.test.com';
$html = file_get_html($url);
$FullTable = $html->find('table');
foreach($FullTable->find('tr[class=ismResult]') as $Heading)
{
echo $Heading;
foreach($FullTable->find('tr[class=ismFixtureSummary]') as $Summary)
{
echo $Summary;
}
}
This doesn't work because it posts the contents of all <tr class="ismFixtureSummary">
into every <tr class="ismResult">
. I am trying to cut them out as a pair.
Thanks for any help you can give.