PHP code example of ewout / retrorcon

1. Go to this page and download the library: Download ewout/retrorcon library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ewout / retrorcon example snippets



// Include the Composer autoloader
emoteConnection;

// Create new RCON instance
$rcon = new RemoteConnection(
    [
        'host' => '127.0.0.1',
        'port' => 12309
    ]
);

// Get online user count
$onlineCount = $rcon->getOnlineCount();

// Is user 'Ewout' online?
$isOnline = $rcon->isUserOnline("Ewout");

// Supports user ID too
$userId = 1;
$isOnline = $rcon->isUserOnline($userId);

// Refresh user figure if online (only meant to be used when figure/motto changed)
if ($isOnline) {
    $rcon->refreshLook($userId);
}