Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h3>RECUPERER DES INFORMATIONS D'UN SERVEUR SANS AUCUNE MODIFICATION OU AJOUT MINECRAFT (n'affiche pas le nom des joueurs -_-')</h3>
- <?php
- function preint_r($array)
- {
- echo '<pre>';
- print_r($array);
- echo '</pre>';
- }
- //remplacez "localhost" et "25565" avec le nom et le port de votre serveur
- $statut = @fsockopen("localhost", 25565, $errno, $errstr, 1);
- if($statut) {
- fwrite($statut, "\xFE\x01");
- $d = fread($statut, 1024);
- if ($d != false AND substr($d, 0, 1) == "\xFF") {
- $d = substr($d, 3);
- $d = mb_convert_encoding($d, 'auto', 'UCS-2');
- $d = explode("\x00", $d);
- fclose($statut);
- preint_r($d);
- // Output:
- // Array
- //
- // [0] => §1
- // [1] => 47
- // [2] => 1.5.2 << Version du serveur
- // [3] => mincraft.net << MOTD
- // [4] => 106 << Joueurs en lignes
- // [5] => 150 << Slots du serveur
- //
- // PARTIE A CHANGER
- $d = str_replace('§e','',$d);
- $d = str_replace('§b','',$d);
- echo 'Version: '.$d[2];
- echo '<br/>';
- echo 'MOTD: '.$d[3];
- echo '<br/>';
- echo 'Joueurs en ligne: '.$d[4];
- echo '<br/>';
- echo 'Nombre de slots: '.$d[5];
- echo '<br/>';
- echo '<br/>';
- echo 'Joueurs en ligne / Slots: '.$d[4].'/'.$d[5];
- // FIN DE LA PARTIE A CHANGER
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment