Created
October 25, 2012 20:37
-
-
Save shoghicp/3955237 to your computer and use it in GitHub Desktop.
Minecraft PHP CLient 2 ping()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
- | |
/ \ | |
/ \ | |
/ MINECRAFT \ | |
/ PHP \ | |
|\ CLIENT /| | |
|. \ 2 / .| | |
| .. \ / .. | | |
| .. | .. | | |
| .. | .. | | |
\ | / | |
\ | / | |
\ | / | |
\ | / | |
by @shoghicp | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU Lesser General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
*/ | |
include("config.php"); | |
require("misc/dependencies.php"); | |
require_once("classes/MinecraftClient.class.php"); | |
define("LOG", false); | |
define("DEBUG", 0); | |
function ping($server, $port, $new = true){ | |
$client = new MinecraftClient($server, ($new === true ? CURRENT_PROTOCOL:39), $port); | |
return $client->ping(); | |
} | |
$server = "mespduendedreams.com"; | |
$port = 25565; | |
$new = false; | |
$ping = ping($server, $port, $new); | |
if($ping === false){ | |
$res = "Error de conexion"; | |
}else{ | |
$res = "Nombre: ".$ping["name"].", Online: ".$ping["online"].", Max: ".$ping["max"].", Version: ".$ping["version"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment