1. Go to this page and download the library: Download rminks/rcon library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rminks / rcon example snippets
use RMinks\RCON\RCON;
$Ip = '127.0.0.1'; //Server IP
$Port = 25575; //RCON port
$Password = '123'; //RCON password
$Timeout = 30; //Timeout in ms
$RCON = new RCON($Ip, $Port, $Password, $Timeout);
use RMinks\RCON\RCON;
...
$RCON->sendCommand('map de_dust2');//Example for CS:S
$RCON->sendCommand('time set day');//Example for Minecraft
use RMinks\RCON\RCON;
...
$Response = $RCON->ResponseService->getAllResponses();
use RMinks\RCON\RCON;
...
$Response = $RCON->ResponseService->getLastResponse();
use RMinks\RCON\RCON;
...
$Response = $RCON->ResponseService->getResponse(3);
namespace App\Http\Controllers;
use RMinks\RCON\RCON;
class RCONController extends Controller
{
public function setDay()
{
$Ip = '127.0.0.1'; //Server IP
$Port = 25575; //RCON port
$Password = '123'; //RCON password
$Timeout = 30; //Timeout in ms
$RCON = new RCON($Ip, $Port, $Password, $Timeout); //Create connection
$RCON->sendCommand('time set day'); //Send command
$Response = $RCON->ResponseService->getLastResponse(); //Get last response
echo $Response;
}
}
namespace App\Http\Controllers;
use RMinks\RCON\RCON;
class RCONController extends Controller
{
public function changeMap()
{
$Ip = '192.168.1.39'; //Server IP
$Port = 27015; //RCON port
$Password = '12345'; //RCON password
$Timeout = 30; //Timeout in ms
$RCON = new RCON($Ip, $Port, $Password, $Timeout); //Create connection
$RCON->sendCommand('map de_dust2'); //Send command
$Response = $RCON->ResponseService->getLastResponse(); //Get last response
echo $Response;
dd($Response);//For debug
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.