• Franรงais English

Onset - PHP Server Query

Onset - PHP Server Query

If you want to display your server information (server viewer) on an external website, you need to communicate with through the OGP protocol, on the query port (UDP) of your server.

In this tutorial, we will see how to use a PHP library to query our Onset server (in real-time) and retrieve server information + the list of connected players.

PHP - OGP Client for Onset

The official PHP client for the OGP protocol was written for PHP 4. We have created a fork compatible with the latest versions of PHP.

Feel free to contribute on Github (https://github.com/mTxServ/php-open-game-protocol-client).

This library is easy to use in your PHP code to allow you to retrieve real-time information, useful by example, to create a Onset server viewer (included in our Onset Server Hosting offers).

First, include the OGP class in your project. To use it:


require_once 'ogp.php';

$ogp = new \OGP\OGP('', 27015);
if(!$ogp->getStatus()) {
    die("Error: ".$ogp->error);


Don't forget to replace:

    The IP address of your Onset private server.
  • 27015
    Query Port of your server (default: port - 1).
Discover mTxServ on Discord   Join the community