Good day. There is a parser that takes the table from another server and displays it on the site. But displaying the entire table is not necessary. And the question itself is how can you delete an unnecessary part of the table? that is, you need to display only 1 to 10 lines, but not from 11 to 20. I did it on CSS, but the table loads everything all right, although its parts are not visible. But it does not suit me.

  • Parse the result and display only what you need. I think, there will be no more specific answer without the code given by you. - Pyramidhead

2 answers 2

Hello. You can use the HTML Dom parser for the response received, and for example, after receiving the table, work with the contents:

foreach($html->find('tr') as $element) echo $element->innertext . '<br>'; 

This is a simple example, you can use, for example, an array, collect the necessary data into it, and then generate the table manually.

    1. Parse the entire table into the string $ table_string

    2. explode('<tr>',$table_string) resulting string into substrings and add to the array using explode('<tr>',$table_string) , the zero element of the resulting array will contain part of the table up to the first tr , and all the other rows.

    3. Delete array elements from 11 onwards through array_splice
    4. Display the array on the screen with missing <tr> , at the end add </table>