You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Test-Miroir/Examples/RconExample.php

33 lines
702 B

<?php
declare(strict_types=1);
require __DIR__ . '/../SourceQuery/bootstrap.php';
use xPaw\SourceQuery\SourceQuery;
// For the sake of this example
header('Content-Type: text/plain');
header('X-Content-Type-Options: nosniff');
// Edit this ->
define('SQ_SERVER_ADDR', 'localhost');
define('SQ_SERVER_PORT', 27015);
define('SQ_TIMEOUT', 1);
define('SQ_ENGINE', SourceQuery::SOURCE);
// Edit this <-
$Query = new SourceQuery();
try {
$Query->Connect(SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE);
$Query->SetRconPassword('my_awesome_password');
var_dump($Query->Rcon('say hello'));
} catch (Exception $e) {
echo $e->getMessage();
} finally {
$Query->Disconnect();
}