1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-06-10 23:03:15 +02:00
Files
Test-Miroir/Examples/RconExample.php
T
Anthony Birkett 780ebba6a2 Create a factory for easy setup.
Update README.md.
2021-05-31 14:53:28 +01:00

26 lines
542 B
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../vendor/autoload.php';
use xPaw\SourceQuery\SourceQueryFactory;
// For the sake of this example
header('Content-Type: text/plain');
header('X-Content-Type-Options: nosniff');
$query = SourceQueryFactory::createSourceQuery();
try {
$query->connect('localhost', 27015, 1);
$query->setRconPassword('my_awesome_password');
var_dump($query->rcon('say hello'));
} catch (Exception $exception) {
echo $exception->getMessage();
} finally {
$query->disconnect();
}