1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-06-10 23:33:15 +02:00

Split up Socket and Rcon classes to be engine specific extensions.

This commit is contained in:
Anthony Birkett
2021-05-31 11:12:21 +01:00
parent a2f7834ef5
commit b01c1f643f
20 changed files with 1520 additions and 1156 deletions
+9 -7
View File
@@ -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);
print_r($Query->GetInfo());
print_r($Query->GetPlayers());
print_r($Query->GetRules());
print_r($Query->getInfo());
print_r($Query->getPlayers());
print_r($Query->getRules());
} catch (Exception $e) {
echo $e->getMessage();
} finally {
$Query->Disconnect();
$Query->disconnect();
}