Skip to content

Instantly share code, notes, and snippets.

@skakri
skakri / mc_status.php
Created March 20, 2012 12:16
Minecraft status (PHP, returns MOTD, online user count, slots, request time)
<?php
/**
* @author Kristaps Karlsons <kristaps.karlsons@gmail.com>
* Licensed under MPL 1.1
*/
function mc_status($host,$port='25565') {
$timeInit = microtime();
// TODO: implement a way to store data (memcached or MySQL?) - please don't overload target server
$fp = fsockopen($host,$port,$errno,$errstr,$timeout=10);