-
Notifications
You must be signed in to change notification settings - Fork 1
/
servercheck.php
47 lines (35 loc) · 982 Bytes
/
servercheck.php
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
37
38
39
40
41
42
43
44
45
46
47
<?php
require __DIR__ . '/PHP-Source-Query-master/SourceQuery/bootstrap.php';
use xPaw\SourceQuery\SourceQuery;
// Edit this ->
define( 'SQ_SERVER_ADDR', 'localhost' );
define( 'SQ_SERVER_PORT', 27015 );
define( 'SQ_TIMEOUT', 3 );
define( 'SQ_ENGINE', SourceQuery::SOURCE );
// Edit this <-
$Timer = MicroTime( true );
$Query = new SourceQuery( );
$Info = Array( );
$Rules = Array( );
$Players = Array( );
try
{
$Query->Connect('139.59.13.200', 27015);
//$Query->SetUseOldGetChallengeMethod( true ); // Use this when players/rules retrieval fails on games like Starbound
$Info = $Query->GetInfo( );
$Players = $Query->GetPlayers( );
$Rules = $Query->GetRules( );
}
catch( Exception $e )
{
$Exception = $e;
}
finally
{
$Query->Disconnect( );
}
$Timer = Number_Format( MicroTime( true ) - $Timer, 4, '.', '' );
echo $Info['HostName'];
echo $Info['Map'];
echo $Info['Players'];
?>