Created
February 23, 2013 13:07
-
-
Save Ribesg/5019666 to your computer and use it in GitHub Desktop.
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 | |
require __DIR__ . '/MCQuery/MinecraftQuery.class.php'; | |
include(__DIR__ . '/MCQuery/class.minecraft.php'); | |
$ip = '91.121.22.150'; | |
$port = '27065'; | |
// Requete | |
$Query = new MinecraftQuery( ); | |
try | |
{ | |
// Requete réussie | |
$Query->Connect( $ip, $port ); | |
$players = $Query->GetPlayers( ); | |
$infos = $Query->GetInfo( ); | |
$playerCount = $infos["Players"]; | |
$slots = $infos["MaxPlayers"]; | |
echo '<h3><a href="">Informations sur le serveur</a> (SECTION EN COURS DE DEVELOPPEMENT ! STATUS : BUGGY AT HELL)</h3>'; | |
echo '<span style="color: #00ff00; font-weight: bold;">SERVEUR EN LIGNE</span>'; | |
echo '<p>Joueurs en ligne : ' . $playerCount . '/' . $slots; | |
echo '<br/>'; | |
foreach( $players as $player ) { | |
$imgUrl = $minecraft->render_skin($player, 'head', 100); | |
echo '<img src="'.$imgUrl.'" width="100" height="100"/>'; | |
} | |
echo '</p>'; | |
} | |
catch( MinecraftQueryException $e ) | |
{ | |
// Requete ratée | |
echo '<h3><a href="">Informations sur le serveur</a> (SECTION EN COURS DE DEVELOPPEMENT ! STATUS : BUGGY AT HELL)</h3>'; | |
echo '<span style="color: #ff0000; font-weight: bold;">SERVEUR HORS LIGNE</span>'; | |
echo $e->getMessage( ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment