1

I'm wanting to make a program which allows for me to check the status of Minecraft servers whether they're online, offline or full. How would I go about doing so? I'm thinking PHP server side, Python client side and SQL as server?

I need some major advice on what needs to be done to achieve such a task.

halfer
  • 19,824
  • 17
  • 99
  • 186

2 Answers2

8

You don't need a database. Ping the server. If it responds, it's up...display a large green checkmark. If it doesn't respond...it's down. Display a large red x. You can do that in the FB API or in plain PHP anywhere.

See this question, which provides the following code:

function ping($host, $port, $timeout)
{ 
  $tB = microtime(true); 
  $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); 
  if (!$fP) { return "down"; } 
  $tA = microtime(true); 
  return round((($tA - $tB) * 1000), 0)." ms"; 
}
Community
  • 1
  • 1
Lusitanian
  • 11,012
  • 1
  • 41
  • 38
  • David, such helpful and straight to the point advice. Thanks buddy. Also, I mentioned SQL by accident. It'll be for another part of this program but I didn't need help with that part so i'm not sure why I even mentioned it lol. – Garrettchap1 Jun 28 '12 at 14:23
1

Notably if you want more information than just the server up/down status you can use the MineQuery protocol that most servers have enabled.

More info @ DinnerBone's tool.

This will allow you to get the current/max players, MOTD, game version, and some other details if the server uses CraftBukkit.

Also this version written in PHP.

Jane Panda
  • 1,591
  • 4
  • 23
  • 51