I need to get online users data from xml file, but simplexml_load_file seems slow. File is big because online users are a lot. I am trying to paginate them 20 per page I have...
<?php $xml = simplexml_load_file('http://domain.tld/data.xml'); ?>
Then
<?php echo $xml->who_is_online[1]->thumbnail_image; ?>
<?php echo $xml->who_is_online[1]->display_name; ?>
<?php echo $xml->who_is_online[1]->display_age; ?>
But there should be about 20 of these per page.
<?php echo $xml->who_is_online[2]->thumbnail_image; ?>
<?php echo $xml->who_is_online[2]->display_name; ?>
<?php echo $xml->who_is_online[2]->display_age; ?>
<?php echo $xml->who_is_online[3]->thumbnail_image; ?>
<?php echo $xml->who_is_online[3]->display_name; ?>
<?php echo $xml->who_is_online[3]->display_age; ?>
etc. (to 20)
What is the better way to get only this certain data from XML without reading the whole file on each page load? I mean get data for user 1 to user 20 on 1st page, then on 2nd page get data for user 21 to 40, etc. On 2nd page I have the same code but getting data for [21], [22], [23], etc.