Jump to content

[Solved] Minecraft Server Vs Website : Online (Open Port 10252)


To175

Recommended Posts

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 !

Link to comment
Share on other sites

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 :(

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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 ? :P

I have to ask heliohost admin to open for me the port 10252 ?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...