mirror of
https://github.com/xPaw/PHP-Source-Query.git
synced 2026-06-11 00:03:15 +02:00
Create a factory for easy setup.
Update README.md.
This commit is contained in:
@@ -2,16 +2,15 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use xPaw\SourceQuery\Socket\SourceSocket;
|
||||
use xPaw\SourceQuery\SourceQuery;
|
||||
use xPaw\SourceQuery\SourceQueryFactory;
|
||||
|
||||
// For the sake of this example
|
||||
header('Content-Type: text/plain');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
|
||||
$query = new SourceQuery(new SourceSocket());
|
||||
$query = SourceQueryFactory::createSourceQuery();
|
||||
|
||||
try {
|
||||
$query->connect('localhost', 27015, 1);
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use xPaw\SourceQuery\Socket\SourceSocket;
|
||||
use xPaw\SourceQuery\SourceQuery;
|
||||
use xPaw\SourceQuery\SourceQueryFactory;
|
||||
|
||||
// For the sake of this example
|
||||
header('Content-Type: text/plain');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
|
||||
$query = new SourceQuery(new SourceSocket());
|
||||
$query = SourceQueryFactory::createSourceQuery();
|
||||
|
||||
try {
|
||||
$query->connect('localhost', 27015, 1);
|
||||
|
||||
+5
-6
@@ -2,14 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use xPaw\SourceQuery\Socket\SourceSocket;
|
||||
use xPaw\SourceQuery\SourceQuery;
|
||||
use xPaw\SourceQuery\SourceQueryFactory;
|
||||
|
||||
$timer = microtime(true);
|
||||
|
||||
$query = new SourceQuery(new SourceSocket());
|
||||
$query = SourceQueryFactory::createSourceQuery();
|
||||
|
||||
$info = [];
|
||||
$rules = [];
|
||||
@@ -17,8 +16,8 @@ $players = [];
|
||||
$exception = null;
|
||||
|
||||
try {
|
||||
$query->connect('localhost', 27015, 3);
|
||||
//$Query->SetUseOldGetChallengeMethod( true ); // Use this when players/rules retrieval fails on games like Starbound
|
||||
$query->connect('localhost', 27015);
|
||||
//$query->setUseOldGetChallengeMethod( true ); // Use this when players/rules retrieval fails on games like Starbound
|
||||
|
||||
$info = $query->getInfo();
|
||||
$players = $query->getPlayers();
|
||||
|
||||
Reference in New Issue
Block a user