Modifying old project to work from a text file

Let me start by saying I know nothing about php, so this might be really easy or impossible

Here is a project:
ftp://belowaverage.org/OUTDATEDPROJECTS/Who’sOnline.zip

It queries a minecraft server, gets the online players and displays them nicely. I was wondering if it’d be possible to edit it so that it doesn’t query a server, but instead reads from a text file (stored on the server with the project) and displays the names in the text file.

I think this is the bit of code that may need to be edited: (/whosonline/dependencies/api.php)

$players = $Query->Players( );
//if nobody is online it shall display this
if(empty($players))
{
    echo '<div id="floatttl">Nobody is online.</div><div id="frown">:(</div>';
}
//
//otherwise
else
{
//it will display this
    foreach($players as $player)

Basically I want to change the ‘$players = $Query->Players( );’ into something like $players = Read text from file and disable to query since it throws an error if not connected to a server

[php]
$players = file(‘path/to/text/file’); //read each line of a file into an array.
[/php]

Just make sure the text file contains what the script expects.

Sponsor our Newsletter | Privacy Policy | Terms of Service