2016-12-06 3 views
0

Получить только строки таблицы из первой таблицы - Простой HTML Dom (PHP)

<table border="3" rules="all" cellpadding="1" cellspacing="1"> 
 
    <tbody> 
 
    <tr> 
 
     <td align="center"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial" color="#000000"> <b>Maandag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>Dinsdag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>Woensdag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>Donderdag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>Vrijdag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>1</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="18" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *verlof </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>3</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>4</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>5</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> stip </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> Os1 </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>6</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>7</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>8</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>9</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    </tbody> 
 
</table>
Моя школа снабжает меня со следующим графиком (как показано выше), но когда я хочу, чтобы разобрать таблицу, используя simplehtmldom. Из этой таблицы я хочу собрать данные, чтобы я мог использовать их в своем приложении.

Какой запрос в simplehtmldom можно использовать для выбора только первых строк таблицы? Как это: Таблица->(все строки)

Когда я пытаюсь этот вопрос: echo($html->find('table tr',0)); И я изменить ноль на 2 (например), он не возвращает следующую строку таблицы основной таблицы , Но вместо этого он возвращает строку таблицы frist таблицы sub в первой строке таблицы.

Не то, чтобы я не мог изменить способ представления таблицы, это таблица, с которой мне нужно работать.

Что я получаю сейчас, когда я выполняю: echo($html->find('table tr',2)); -> "Maandag"

То, что я хотел бы получить: <tr><td rowspan="2" align="center" nowrap="1"><table><tbody><tr><td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td></td></tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> </td> </tr><tr><td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> </td> </tr><tr><td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td></td></tr></tbody></table></td></tr>(следующая TableRow первого (основного) таблицы)

как я загрузить в HTML таблице:

$html = file_get_html($timetableURL); 
$timeTable = $html->find('table',0); //I need to do this because the page with the timetable has more html tables, I tested this and it always fetches the timetable as seen above. 

Смежный вопрос: PHP Simple HTML DOM Parser how to get TR only from first table только я хочу, чтобы выбрать второй или третьей строки первой таблицы, например.

echo($timeTable->find('tr',2)); 
+1

Можете ли вы показать больше об этом, как о том, как ваш документ DOM инициализирует документ и загружает в него желаемый результат. Тогда мне будет легче. –

+0

Добавил его, я также добавил связанный с ним вопрос, в котором у кого-то такая же проблема. – sloeberGJ

ответ

1

Я использовал цикл while и функцию simple-html-dom nextSibling().

$tableCell = $row->find('td', 0); 
while($tableCell){ 
    $tableCell = $tableCell->next_sibling(); //Go to the next tableCell 
} 
0

Вы можете использовать JQuery селектор :first извлечь первый элемент из DOM

Вы можете сделать это следующим образом:

$(function() { 
 
\t var table = $('table:first'); 
 
\t var table_rows = table.find('tr'); 
 
\t alert(" There are " + table_rows.length + " rows in Table"); 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<table border="3" rules="all" cellpadding="1" cellspacing="1"> 
 
    <tbody> 
 
    <tr> 
 
     <td align="center"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial" color="#000000"> <b>Maandag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>Dinsdag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>Woensdag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>Donderdag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>Vrijdag</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>1</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="18" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *verlof </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>3</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>4</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>5</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> stip </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> Os1 </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>6</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>7</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>8</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> 
 
       </td> 
 
       <td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font> 
 
       </td> 
 
      </tr> 
 
      <tr> 
 
       <td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    <tr> 
 
     <td rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td align="center" nowrap="1"><font size="2" face="Arial"> <b>9</b> </font> 
 
       </td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
     <td colspan="12" rowspan="2" align="center" nowrap="1"> 
 
     <table> 
 
      <tbody> 
 
      <tr> 
 
       <td></td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </td> 
 
    </tr> 
 
    <tr></tr> 
 
    </tbody> 
 
</table>

Надеется, что это помогает!

+0

Это не работает, так как он также выбирает вложенные строки таблицы (tr). Кроме того, я не могу использовать jquery. – sloeberGJ

1

Это немного запутанный с простым в HTML-доме:

// find the first table 
$table = $html->find('table', 0); 

// iterate all tr's 
foreach($table->find('tr') as $tr){ 

    // skip the tr's that are not top level 
    if($tr->parent->parent != $table) continue; 

    do_something_with($tr); 
} 
0

пересекающего ваш DOM структуру, и я считаю, что tr, что вы хотите это четвёртая ребенок тр, который непосредственно под tbody элемента при table.

Таким образом, запрос вам нужно может быть что-то вроде этого

// assume table is the root/parent DOM 
$tr = $table->find('tbody > tr:nth-child(4)'); 
var_dump($tr->html()); 

К сожалению, если синтаксис PHP неверен. Это фактически протестировано против библиотеки phpquery.