Git Product home page Git Product logo

php-minecraft-rcon's People

Contributors

fwahlberg avatar immanuelnl avatar kriation avatar metroyanno avatar ricardoboss avatar scrutinizer-auto-fixer avatar thedudeguy avatar wruczek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-minecraft-rcon's Issues

Cant connect

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

Auto recomment

Is there any way to automatically reconnect if the conection timed out? Some type of function for it or something like that?

Connection Refused

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

一直显示Rcon.php的第68行有问题

一直显示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
`

Fatal Error about memory

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

[Not solved, please help!] Not working ^_^

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

Where i can get class 'Thedudeguy\Rcon'

When i run a site, he have a:

Fatal error: Class 'Thedudeguy\Rcon' not found in D:\OpenServer\domains\Timpixel-Main\donate_buy\PHP-Minecraft-Rcon-master\src\run.php on line 14

Where i can get this class?
Can u send me this class?

use doesn't work

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?

rcon php is not work

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.

Processing messages

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";}

Composer package

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"

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

an error

Fatal error: Uncaught Error: Class "Rcon" not found
i have tested on 1 bilion ways but it dont works

unpack(): Type V: not enough input, need 4, have 0

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.

Not work :(

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

:(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.