mirror of
https://github.com/xPaw/PHP-Source-Query.git
synced 2026-06-11 00:23:15 +02:00
Split up Socket and Rcon classes to be engine specific extensions.
This commit is contained in:
@@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use xPaw\SourceQuery\SourceQuery;
|
||||
use xPaw\SourceQuery\Socket\SourceSocket;
|
||||
use xPaw\SourceQuery\Socket\SocketType;
|
||||
|
||||
// For the sake of this example
|
||||
header('Content-Type: text/plain');
|
||||
@@ -14,19 +16,19 @@ header('X-Content-Type-Options: nosniff');
|
||||
define('SQ_SERVER_ADDR', 'localhost');
|
||||
define('SQ_SERVER_PORT', 27015);
|
||||
define('SQ_TIMEOUT', 1);
|
||||
define('SQ_ENGINE', SourceQuery::SOURCE);
|
||||
define('SQ_ENGINE', SocketType::SOURCE);
|
||||
// Edit this <-
|
||||
|
||||
$Query = new SourceQuery();
|
||||
$Query = new SourceQuery(new SourceSocket());
|
||||
|
||||
try {
|
||||
$Query->Connect(SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE);
|
||||
$Query->connect(SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE);
|
||||
|
||||
$Query->SetRconPassword('my_awesome_password');
|
||||
$Query->setRconPassword('my_awesome_password');
|
||||
|
||||
var_dump($Query->Rcon('say hello'));
|
||||
var_dump($Query->rcon('say hello'));
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
} finally {
|
||||
$Query->Disconnect();
|
||||
$Query->disconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user