NitrAPI-PHP
NitrAPI-PHP copied to clipboard
List Whitelist
can anybody help me? I am trying to view the tags in the list using php. I don't know how to use the API.
Getting the users on the whitelist can be done like this:
require_once 'vendor/autoload.php'; // Load Composer's autoloader
use Nitrapi\Nitrapi;
$nitrapi = new Nitrapi('your_api_key', 'your_api_secret');
// Define the server ID for the game server you want to retrieve the whitelist for
$serverId = 'your_server_id';
try {
// Get the whitelist for the specified server
$whitelist = $nitrapi->gameservers->getServerWhitelist($serverId);
// Print the whitelist entries
foreach ($whitelist as $entry) {
echo "Player: " . $entry->getUsername() . "\n";
}
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
Whitelist not longer working, now display a 501 error