Giter Club home page Giter Club logo

php-minecraft-server-status-query's Introduction

Minecraft Server Status Query

Minecraft server status query with slots and online players query without plugins and enable-query. Download all files, view the example.php on your webserver and feel free to use it.

Tutorial

Firstly, you have to include in your php file the status.class.php and call the class.

include_once 'MinecraftServerStatus/status.class.php'; //include the class
$status = new MinecraftServerStatus(); // call the class

Then you call the getStatus() function. You have to replace the domain 'pvp24.com' with the ip or domain of your server.

$response = $status->getStatus('pvp24.com'); // call the function 

Also if your server dont have the default port (25565) you can add it as getStatus(ip, port).

$response = $status->getStatus('pvp24.com', 25565); // when you dont have the default port 

After that you only have to check the response.

if(!$response) {
	echo"The Server is offline!";
} else {
	echo"The Server ".$response['hostname']." is running on ".$response['version']." and is online,
	currently are ".$response['players']." players online
	of a maximum of ".$response['maxplayers'].". The motd of the server is '".$response['motd']."'. 
	The server has a ping of ".$response['ping']." milliseconds.";
}

If the server is offline it returns false else it returns an array which contains the variables 'hostname', 'players', 'maxplayers', 'motd', 'version' and 'ping'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.