-
-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathExample.php
More file actions
36 lines (29 loc) · 719 Bytes
/
Example.php
File metadata and controls
36 lines (29 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.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 );
print_r( $Query->GetInfo( ) );
print_r( $Query->GetPlayers( ) );
print_r( $Query->GetRules( ) );
}
catch( Exception $e )
{
echo $e->getMessage( );
}
finally
{
$Query->Disconnect( );
}