Skip to content

Instantly share code, notes, and snippets.

@Ribesg
Created February 23, 2013 13:07
Show Gist options
  • Save Ribesg/5019666 to your computer and use it in GitHub Desktop.
Save Ribesg/5019666 to your computer and use it in GitHub Desktop.
<?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