thedudeguy / php-minecraft-rcon Goto Github PK
View Code? Open in Web Editor NEWSimple Rcon class for php.
License: MIT License
Simple Rcon class for php.
License: MIT License
Warning: unpack(): Type V: not enough input, need 4, have 0 in C:\xampp\htdocs\MinecraftCP\rcon.php on line 198
Notice: Trying to access array offset on value of type bool in C:\xampp\htdocs\MinecraftCP\rcon.php on line 199
Warning: fread(): Length parameter must be greater than 0 in C:\xampp\htdocs\MinecraftCP\rcon.php on line 207
Warning: unpack(): Type V: not enough input, need 4, have 0 in C:\xampp\htdocs\MinecraftCP\rcon.php on line 208
Notice: Trying to access array offset on value of type bool in C:\xampp\htdocs\MinecraftCP\rcon.php on line 143
Is there any way to automatically reconnect if the conection timed out? Some type of function for it or something like that?
Hi i read the redme and there is nothing about how to get the responses
Hi,
When I'm trying to connect it to my localhost server, it'll always throw "Connection Refused" (I already tried '127.0.0.1', '0.0.0.0' and 'localhost' but neither of these works). The weird thing is that it's working when im using mcrcon. (Im running macOS Catalina 10.15.16).
Thanks
I know this is a known issue, but has there been any progress to getting packets larger than 4096 working?
https://github.com/xPaw/PHP-Source-Query/blob/master/SourceQuery/SourceRcon.php has it done, but I like the way your API is setup.
Last time I did not understand enough what I was told, but now I will do everything that you advise me to solve this problem !!!
My site can send only "say hello world!" and "bc {msg}"
Other command in console send this:
Rcon connection from: /195.60.229.4
What i can do? Tell me pls!
Code:
http://timpixel-drive.ddns.net/uploades/Timpixel2020/this111.txt
How get tps?
一直显示Rcon.php的第68行有问题,我怀疑是PHP的版本不对(我当时用的是PHP 5.6),所以我升级了版本(现在是PHP 7.4),但是依旧会报错。
求解决,挺急的 ╥﹏╥
`
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /www/wwwroot/duxianmen.com/api/mc_server_rcon/src/Rcon.php on line 68
Warning: fsockopen(): unable to connect to xhn.server.xyc.red:35974 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /www/wwwroot/duxianmen.com/api/mc_server_rcon/src/Rcon.php on line 68
`
Hello. My script connects to my server, but then i get this error:
Edit: Also i'm not actually running the RCON on a Minecraft server, but a Unturned one. Would this have something to do with it? Should i try it with a minecraft server?
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1801678675 bytes) in C:\xampp\htdocs\PHP Testing\Rcon.php on line 207
Here is my index file (sorry if the scripting is bad, i'm sorta new to php): https://pastebin.com/VevZqCkH
And the send.php file: https://pastebin.com/nkAAPcZg
Thanks, Xander
Hey, I know this project is very old but is there any way to send commands that contain variables to the server?
Thanks
The script is
require_once('rcon.php');
$host = 'my host'; // Server host name or IP
$port = 25575; // Port rcon is listening on
$password = 'my password'; // rcon.password setting set in server.properties
$timeout = 3; // How long to timeout.
use Thedudeguy\Rcon;
$rcon = new Rcon($host, $port, $password, $timeout);
if ($rcon->connect())
{
$rcon->sendCommand("say test");
echo $rcon->get_response();
} else {
echo "no, lol";
}
And I get "no, lol" message in index file (without "else", I get nothing), what to do? I looked in console, command not sended. No error, no nothing
My site can send only "say hello world!" and "bc {msg}"
Other command in console send this:
Rcon connection from: /195.60.229.4
What i can do? Tell me pls!
Code:
http://timpixel-drive.ddns.net/uploades/Timpixel2020/this111.txt
When i send a command with your beautiful code, how can i get the answer of the command i send?
Its not really an Issue, but i cant find another way to contact you ;)
My site can send only "say hello world!" and "bc {msg}"
Other command in console send this:
What i can do? Tell me pls!
Code:
http://timpixel-drive.ddns.net/uploades/Timpixel2020/this111.txt
When i run a site, he have a:
Where i can get this class?
Can u send me this class?
Hello,
i'm currently writing a RCON-PHP-Client and i want to use this rocn.php.
But if i'm trying to use it VSCode says at use Thedudeguy\Rcon;
: syntax error, unexpected 'use' (T_USE)
https://i.imgur.com/v8bYmvL.png
Can someone help me?
require_once "rcon.php";
$host = $host_ST;
$port = $port_ST;
$password = $password_ST;
$timeout = $timeout_ST;
use Thedudeguy\Rcon;
$rcon = new Rcon($host, $port, $password, $timeout);
error_reporting(E_ALL);
if($rcon->connect()) echo "+";
else echo "-";
Help, please, tried the old solution to this error.
Topic ;v
Adding this code will make it send messages 🎱
public function send_message($message,$target) {
if (!$this->is_connected()) {return false;}
return $this->send_command($this->parse($message,$target));}
private function parse($str,$target) {
$ar=Array();$k=0;$str=str_replace(Array("\r","\n"),"",$str);
foreach(explode("§",$str) as $code) {$c=$this->parsecolor($code);if($c!=NULL) {$ar[$k]["text"]=str_replace("Â","",substr($code,1));$ar[$k]["color"]=$c;$k++;}}return "tellraw ".$target." ".json_encode(Array("text"=>"","extra"=>$ar));}
private function parsecolor($str) {
if($str=="") {return "";}
$cl=ord(substr($str,0,1));
$co2=Array("black","dark_blue","dark_green","dark_aqua","dark_red","dark_purple","gold","gray","dark_gray","blue","green","aqua","red","light_purple","yellow","white");
if ($cl>=48 && $cl<=57) {return $co2[$cl-48];}if ($cl>=97 && $cl<=102) {return $co2[10+$cl-97];}if ($cl>=65 && $cl<=70) {return $co2[10+$cl-65];}if ($cl==ord("r")) {return "gray";}return "err";}
Your library is very simple to use, please create a composer package for this lib, so it's easier to include into projects!
-Keep up to good work!
can only send "say hello world" and "stop" all other commands just show:
Rcon connection from : /127.0.0.1
I am testing this on a vanilla server
Fatal error: Uncaught Error: Class "Rcon" not found
i have tested on 1 bilion ways but it dont works
Please discuss any issues related to using this library with Unturned / RocketMod in this thread.
The error occurred can update this code, I need it very much.
I am using this code on a Laravel based system
$rcon = new Rcon('ip, port, 'password', 1);
if ($rcon->connect())
{
Log::info('connected');
$rcon->sendCommand("say Hello World!");
} else {
Log::info('disconected');
}
but if ($rcon->connect())
returns me the error unpack(): Type V: not enough input, need 4, have 0
which comes from
$size_data = fread($this->socket, 4);
$size_pack = unpack('V1size', $size_data);
But when I log all the variables inside the vendor src file, it does log the right info provided in the new Rcon.
With this code :
`
$host = " *********:145 "; // Server host name or IP
$port = "145"; // Port rcon is listening on
$password = " **** "; // rcon.password setting set in server.properties
$timeout = 3; // How long to timeout.
$rcon = new Rcon($host, $port, $password, $timeout);
if ($rcon->connect())
{
$rcon->send_command("say Hello World!");
}
}
`
It not work it return :
Warning: unpack(): Type V: not enough input, need 4, have 0 in /var/www/html/lib/rcon.php on line 147
Warning: fread(): Length parameter must be greater than 0 in /var/www/html/lib/rcon.php on line 156
Warning: unpack(): Type V: not enough input, need 4, have 0 in /var/www/html/lib/rcon.php on line 157
:(
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.