Guest User

Untitled

a guest
Nov 5th, 2012
192
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $serverstatus = mc_status("SERVER IP GOES HERE, INCLUDING PORT EX: 1.1.1.1:25565");
  3. function mc_status( $server ) {
  4. if($socket = stream_socket_client('tcp://'.$server , $errno, $errstr, 3)){
  5. fwrite($socket, "\xfe\x01");
  6. $tmp = fread($socket, 2048);
  7. $tmp = str_replace("\x00","",$tmp);
  8. $tmp = substr ($tmp,5,6);
  9. $ver = substr($tmp,1);
  10. if($ver != "1.4.2"){
  11. $ver = "1.3.2";
  12. }
  13. fclose($socket);
  14. //sleep(3);
  15. if($socket = stream_socket_client('tcp://'.$server , $errno, $errstr, 3)){
  16. fwrite($socket, "\xfe");
  17. $tmp = fread($socket, 2048);
  18. $tmp = str_replace("\x00","",$tmp);
  19. $tmp = substr($tmp, 1);
  20. $tmp = str_replace("\xa7","&", $tmp);
  21. $temp = explode("&",$tmp);
  22. print("IP: " . $server . "<br />Server Version: " . $ver . "<br />MOTD: " . $temp[0] . "<br />Players Online: " . $temp[1] . "/" . $temp[2]);
  23. }else{
  24. return false;
  25. }
  26. } else {
  27. return false;
  28. }
  29. }
  30. ?>
RAW Paste Data