-
Posts
86 -
Joined
-
Last visited
Everything posted by To175
-
If I use this code, I have this error : Failed to receive challenge. CODE : <?php require __DIR__ . '/MinecraftQuery.class.php'; $Query = new MinecraftQuery( ); try { $Query->Connect( 'localhost', 25565 ); print_r( $Query->GetInfo( ) ); print_r( $Query->GetPlayers( ) ); } catch( MinecraftQueryException $e ) { echo $e->getMessage( ); } ?> With this class : <?php class MinecraftQueryException extends Exception { // Exception thrown by MinecraftQuery class } class MinecraftQuery { /* * Class written by xPaw * * Website: http://xpaw.ru * GitHub: https://github.com/xPaw/PHP-Minecraft-Query */ private $Socket; private $Challenge; private $Players; private $Info; public function Connect( $Ip = 'serveurmecraft.tk', $Port = 10252, $Timeout = 3 ) { if( $this->Socket = FSockOpen( 'udp://' . $Ip, (int)$Port ) ) { Socket_Set_TimeOut( $this->Socket, $Timeout ); if( !$this->GetChallenge( ) ) { FClose( $this->Socket ); throw new MinecraftQueryException( "Failed to receive challenge." ); } if( !$this->GetStatus( ) ) { FClose( $this->Socket ); throw new MinecraftQueryException( "Failed to receive status." ); } FClose( $this->Socket ); } else { throw new MinecraftQueryException( "Can't open connection." ); } } public function GetInfo( ) { return isset( $this->Info ) ? $this->Info : false; } public function GetPlayers( ) { return isset( $this->Players ) ? $this->Players : false; } private function GetChallenge( ) { $Data = $this->WriteData( "\x09" ); if( !$Data ) { return false; } $this->Challenge = Pack( 'N', $Data ); return true; } private function GetStatus( ) { $Data = $this->WriteData( "\x00", $this->Challenge . "\x01\x02\x03\x04" ); if( !$Data ) { return false; } $Last = ""; $Info = Array( ); $Data = SubStr( $Data, 11 ); // splitnum + 2 int $Data = Explode( "\x00\x00\x01player_\x00\x00", $Data ); $Players = SubStr( $Data[ 1 ], 0, -2 ); $Data = Explode( "\x00", $Data[ 0 ] ); // Array with known keys in order to validate the result // It can happen that server sends custom strings containing bad things (who can know!) $Keys = Array( 'hostname' => 'HostName', 'gametype' => 'GameType', 'version' => 'Version', 'map' => 'Map', 'numplayers' => 'Players', 'maxplayers' => 'MaxPlayers', 'hostport' => 'HostPort', 'hostip' => 'HostIp' ); foreach( $Data as $Key => $Value ) { if( ~$Key & 1 ) { if( !Array_Key_Exists( $Value, $Keys ) ) { $Last = false; continue; } $Last = $Keys[ $Value ]; $Info[ $Last ] = ""; } else if( $Last != false ) { $Info[ $Last ] = $Value; } } // Ints $Info[ 'Players' ] = IntVal( $Info[ 'Players' ] ); $Info[ 'MaxPlayers' ] = IntVal( $Info[ 'MaxPlayers' ] ); $Info[ 'HostPort' ] = IntVal( $Info[ 'HostPort' ] ); // Parse "plugins", if any if( $Info[ 'Plugins' ] ) { $Data = Explode( ": ", $Info[ 'Plugins' ], 2 ); $Info[ 'RawPlugins' ] = $Info[ 'Plugins' ]; $Info[ 'Software' ] = $Data[ 0 ]; if( Count( $Data ) == 2 ) { $Info[ 'Plugins' ] = Explode( "; ", $Data[ 1 ] ); } } else { $Info[ 'Software' ] = 'Vanilla'; } $this->Info = $Info; if( $Players ) { $this->Players = Explode( "\x00", $Players ); } return true; } private function WriteData( $Command, $Append = "" ) { $Command = "\xFE\xFD" . $Command . "\x01\x02\x03\x04" . $Append; $Length = StrLen( $Command ); if( $Length !== FWrite( $this->Socket, $Command, $Length ) ) { return false; } $Data = FRead( $this->Socket, 1440 ); if( StrLen( $Data ) < 5 || $Data[ 0 ] != $Command[ 2 ] ) { return false; } return SubStr( $Data, 5 ); } }
-
Hi, this code works for me : $fp = @fsockopen("mecraft.omgcraft.fr", "10252", $errno, $errstr, 1); But this doesn't work : http://pastebin.com/UC29WcpH Help me please ! In server.properties I have the query=true Thanks
-
[Solved] Minecraft Server Vs Website : Online (Open Port 10252)
To175 replied to To175's topic in Escalated Requests
Ok, code works now thanks @Krydos -
[Solved] Minecraft Server Vs Website : Online (Open Port 10252)
To175 replied to To175's topic in Escalated Requests
Thanks, I have some troubles with CPanel, the FTP manager doesn't work... there is "dataerror". And now I can't use other sites... + each time I connect to PHPMyAdmin... My server crashes... " 500 internal error... -
[Solved] Minecraft Server Vs Website : Online (Open Port 10252)
To175 replied to To175's topic in Escalated Requests
Thanks, how long I have to wait please ? -
[Solved] Minecraft Server Vs Website : Online (Open Port 10252)
To175 replied to To175's topic in Escalated Requests
Ho yes please + I have send a private message but it is better to see this post My server is really big yeah -
[Solved] Minecraft Server Vs Website : Online (Open Port 10252)
To175 replied to To175's topic in Escalated Requests
Ho thanks you very much ! I can have 20 or 30 players but not everytimes... "If you don't mind having a max of 20 players online at any one time" I don't understand the problem ? It can be nice if you could give me my variables but I didn't understand ? I have to ask heliohost admin to open for me the port 10252 ? -
[Solved] Minecraft Server Vs Website : Online (Open Port 10252)
To175 replied to To175's topic in Escalated Requests
Hoookey boy ! yOU are fantastic !! I'm really not handy with thoses codes... Hum in better proper english, may I have your entire script please ?! => my server is Mecraft.omgcraft.fr:10252 and I CAN'T change this port. <?php $ip = 'mecraft.omgcraft.fr'; $port = 10252; $onlinePlayers = 0; $maxPlayers = 0; $serverMotd = 'TESTTT'; $serverSock = @stream_socket_client('tcp://'.$ip.':'.$port, $empty, $empty, 1); if($serverSock !== FALSE) { fwrite($serverSock, "\xfe"); $response = fread($serverSock, 2048); $response = str_replace("\x00", '', $response); $response = substr($response, 2); $data = explode("\xa7", $response); unset($response); fclose($serverSock); if(sizeof($data) == 3) { $serverMotd = $data[0]; $onlinePlayers = (int) $data[1]; $maxPlayers = (int) $data[2]; echo $serverMotd.'<br/>'; echo $onlinePlayers.'/'.$maxPlayers.' player(s) online.'; }else{ echo 'Could not connect.'; } }else{ echo 'Server is offline.'; } ?> This code just display "server is offline" :'( in my server.proprieties query.port=10252 rcon.port=40729 server-port=10252 -
[Solved] Minecraft Server Vs Website : Online (Open Port 10252)
To175 replied to To175's topic in Escalated Requests
Thank, But this is not the question :s I have tested all codes I could, I dont have them anymore... I though the problem is because of the port but I don't think so now. I really don't want to use a plugin in my server to do that ! Ok, for example This doesn't work for me http://www.webmaster-source.com/2012/07/05/checking-the-status-of-a-minecraft-server-with-php/ I used my server : Mecraft.omgcraft.fr with port 10252 Help please -
Hi, when can I access to thoses services please ? Thanks
-
Hi, 1 or 2 hours ago and still now #2002 - Le serveur ne répond pas (ou l'interface de connexion vers le serveur MySQL local n'est pas correctement configurée)
-
Ok so if you say that... You seem to have experience in minecraft, so, do you know a plugin which doesn't need any port and don't gather so much ressources ? A plugin like JSONAPI to interact with the server ? Thanks
-
Because JSONAPI is the best... with all possibilities and simplicity...
-
Since you didn't really answer this question I'll ask it in a different way. Why can't you just use one port? I need 3 because the autors of the plugin said that JSONAPI takes the "first" port and the 2 other ports following... I'm a little afraid because the moderators said I can't have those ports ? :(/&--#62;
-
Hi, thanks you very much for your answer and to spend so much time for us ! I have a minecraft server : 3 years paid ! So I am making a support website (http://sciences.webfrag.tk/minecraft) That is why I need to interact site/server. There is a plugin called JSONAPI and it need 3 ports, consecutive ports. My minecraft host can't open other ports than : 1 88.191.242.16 40086 2 88.191.242.16 40087 3 88.191.242.16 40088 4 88.191.242.16 40089 5 88.191.242.16 40090 So if you can open 40086 or 40086 or 40088 and the 2 ports following (3 in all) it will be great Thanks you
-
Thanks very much for these 3 ports, thanks thanks thanks.
-
Thanks, My host sais that they can't give me an other port, I have only 40088, 40089 and 40090 can you please open these ports for my site ?
-
Hi, sorry I think I can't open other port. The port is 40088 (40089, 40090) and I need 3 ports on my site, isn't it possible to open 40088->40090 ? I will ask my host. Thanks
-
Hi, I need to use JSONAPI for my minecraft server. I want to user varients of my server for my site ! I use the port 40088 on my server. I use this code to connect to my server : <?php require 'JSONAPI.php'; $api = new JSONAPI("88.191.242.16", 40088, "to175", "password", "salt"); var_dump($api->call("getPlayerLimit")); ?> But I see on the page : "NULL" The minecraft hoster said that it can have for origine my site, because of the port which cannot be open? So why I see NULL on my page? I can't use 40088 ? Thanks
-
Ok thanks, I will remember that
-
Ok thanks, when can I have news ?
-
No I can not, it says when I try to log: Connexion au serveur MySQL non permise When I log in cpanel and click phpmyadmin, there is the loggin page but without password, I am not connected...
-
Thanks, • Thio175 • http://webfrag.tk/ I found first problem on http://sciences.webfrag.tk/ • stevie