1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-05-18 14:33:34 +02:00

Rcon example

This commit is contained in:
xPaw
2014-07-22 22:04:48 +03:00
parent 5e84d9e873
commit b6cb74d1a8
2 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
Header( 'Content-Type: text/plain' ); Header( 'Content-Type: text/plain' );
// Edit this -> // Edit this ->
define( 'SQ_SERVER_ADDR', 'gs2.my-run.de' ); define( 'SQ_SERVER_ADDR', 'localhost' );
define( 'SQ_SERVER_PORT', 27015 ); define( 'SQ_SERVER_PORT', 27015 );
define( 'SQ_TIMEOUT', 1 ); define( 'SQ_TIMEOUT', 1 );
define( 'SQ_ENGINE', SourceQuery :: SOURCE ); define( 'SQ_ENGINE', SourceQuery :: SOURCE );
+29
View File
@@ -0,0 +1,29 @@
<?php
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
// For the sake of this example
Header( 'Content-Type: text/plain' );
// 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 );
$Query->SetRconPassword( 'my_awesome_password' );
var_dump( $Query->Rcon( 'say hello' ) );
}
catch( Exception $e )
{
echo $e->getMessage( );
}
$Query->Disconnect( );