Is it possible to query a server:port via PHP?

Hi all, new year, but LOVE MineOS. I was wondering if it’s possible to query a specific server/port to tell if it’s online or not, specifically in PHP. I have a webpage setup for my Minecraft servers (I’m running about 5 or 6 different servers across 2 physical boxes). I’d like to include a notice on that page whether the server is physically running or not. Is that possible? Thanks!

Yep, there’s definitely a way to ping/query servers from PHP. One such project is PHP-Minecraft-Query, which you should be able to implement into your websites.

As the readme explains, there’s two different methods, ping and query (ping is limited in info, what MineOS uses) and query is more sophisticated but requires each server to enable queries in server.properties.

Oh neat, thanks for the info! I admit I probably will not take the time to implement now that I see it, because I’m a stubborn old man and OO programming style scares and confuses me. I’m a procedural kind of guy. :stuck_out_tongue: But if I get a free afternoon, I might take a stab at it. Thanks again!

I think alternatively you could poll MineOS for JSON at /vm/status. This is the approach the web-ui uses, which basically asks MineOS on the host to do those pings on your behalf. Then, you’d just have to parse the JSON, which should be pretty straightforward.