← All guides

Live player count integration

Show a recent online count from your own server with a tiny, pure-PHP HTTPS endpoint. This integration is a Premium feature.

Premium feature: Requires an active Premium listing. Free listings cannot configure or fetch the player count; the count is hidden whenever Premium is inactive.

Two response formats are supported: JSON with a top-level players_online value, or a plain response containing only the number.

01. Add the Premium endpoint to your listing

An active Premium listing is required. In your owner dashboard, edit the listing and open 05. Technical integration — Optional tools for established realms. Enter a publicly reachable HTTPS URL in Live player count URL. C.O.P.S. fetches it in the background only while Premium is active—approximately every two minutes—and keeps the last valid result only for a short freshness window. The count appears on the directory listing and server page when available; it is hidden whenever Premium is inactive.

The endpoint must not require authentication headers or cookies. Test the URL directly in a browser or with a simple HTTP client before adding it to C.O.P.S.

02. JSON response

Use this when your server or database query produces a count:

PHP
<?php

// Replace this with the query used by your server/database.
$playersOnline = 42;

header('Content-Type: application/json');

echo json_encode([
    'players_online' => (int) $playersOnline
]);

Expected response:

JSON
{"players_online":42}

Other JSON fields are allowed and ignored. The count must be the top-level players_online value.

03. Plain number response

The endpoint can return only the integer instead:

PHP
<?php

// Replace this with the query used by your server/database.
$playersOnline = 42;

header('Content-Type: text/plain');

echo (int) $playersOnline;

Expected response:

Plain text
42

04. Response rules

  • HTTPS is required and the endpoint must be publicly reachable by C.O.P.S.
  • The accepted range is 0–9999; zero is a valid count.
  • Plain-text responses must contain only the integer, apart from surrounding whitespace.
  • Do not output HTML, debugging messages, warnings, labels, floats, or other text.
  • Do not require authentication headers or cookies.
  • Temporary failures result in an unknown live count rather than being treated as zero.

For example, 42 players, <b>42</b>, 42.0, and an HTML page are not valid responses.