1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-06-11 00:23:15 +02:00
Files
Test-Miroir/Examples/Example.php
T
Anthony Birkett d9bab8aa25 Remove engine from the Sockets.
Docblock changes.
Reorder methods to be logical.
2021-05-31 11:52:18 +01:00

27 lines
574 B
PHP

<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use xPaw\SourceQuery\SourceQuery;
use xPaw\SourceQuery\Socket\SourceSocket;
// For the sake of this example
header('Content-Type: text/plain');
header('X-Content-Type-Options: nosniff');
$query = new SourceQuery(new SourceSocket());
try {
$query->connect('localhost', 27015, 1);
print_r($query->getInfo());
print_r($query->getPlayers());
print_r($query->getRules());
} catch (Exception $exception) {
echo $exception->getMessage();
} finally {
$query->disconnect();
}