To175 Posted May 11, 2014 Posted May 11, 2014 Hi, I have tried everything, please help me !I need to display some variables of my minecraft server on my website.I thought it was a problem of port but I think not... I don't know why I can't display for example : server on/off ; number of players online.Do you know how to do please ?Thanks !
nyten Posted May 11, 2014 Posted May 11, 2014 Hi,which script do you use or how do you try to connect to your server?
To175 Posted May 11, 2014 Author Posted May 11, 2014 Thank,But this is not the question :sI 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 mehttp://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
wolstech Posted May 11, 2014 Posted May 11, 2014 I am doing the same thing. The normal ports for minecraft are blocked. Instead of 25565, run the server on 51990 and a simple up/down will work (assuming you're on Stevie). If you put rcon or something else on that port, you could probably do something more advanced. I run mine on port 51990 exactly for this reason. (http://www.acmine.tk on the right side you can see my status monitor working, site is under construction)
To175 Posted May 11, 2014 Author Posted May 11, 2014 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.proprietiesquery.port=10252rcon.port=40729server-port=10252
wolstech Posted May 11, 2014 Posted May 11, 2014 That script is actually just a PHP fsockopen() and an if statement with echo statements in it. Like 10 lines of code. Basically do an fsockopen() call to the game server, if it succeeds echo an online message, else echo offline message. I'd have to dig up the source if you want the exact script, I didn't write that (my friend who co-owns my server with me made it). If you cannot change the port, you cannot monitor it here unless an admin opens the port for you (which we rarely do and frown upon for security reasons). You'd have to ask an admin about that. I run my server myself, hence my recommendation. Also, how big of a server are you planning on running? If you don't mind having a max of 20 players online at any one time, I might be able to host your current world as a second map on my server, which would provide compatibility with your website (and give you a bunch of other things like mods and the ability to use stuff/go mining in my world).
To175 Posted May 11, 2014 Author Posted May 11, 2014 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 ?
wolstech Posted May 11, 2014 Posted May 11, 2014 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 ?"My server only handles 10 or so people at a time. More makes it lag. I have to ask heliohost admin to open for me the port 10252 ? Yes. I can move this topic for you so they see it. Do you want me to do that?
To175 Posted May 11, 2014 Author Posted May 11, 2014 Ho yes please + I have send a private message but it is better to see this post My server is really big yeah
wolstech Posted May 11, 2014 Posted May 11, 2014 This support request is being escalated to our root admin. @Krydos: This user can't change the port to something else, he's on a minecraft host that doesn't allow it. 1
wolstech Posted May 12, 2014 Posted May 12, 2014 Until krydos get around to reading and responding to ths topic. Sometimes it's within a day, other times it can take several days.
To175 Posted May 13, 2014 Author Posted May 13, 2014 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...
yashrs Posted May 13, 2014 Posted May 13, 2014 The data error is due to Stevie getting updated. We are in the process of updating the cpanel and that's why your experiencing these issues. It should be fixed soon.
Recommended Posts