Hello,
Quick Question, I followed the tut to the letter I've triple checked it but I still get funky chars:
array(3) { [0]=> string(29) "SomethingCraft Public Server�" [1]=> string(2) "9�" [2]=> string(3) "100" }
mc.somethingcraft.co.uk
Status: Online
motd: SomethingCraft Public Server�
Players: 9/100
I'am getting the ? still
[syntax=php]<?php
function fetch_server_info($ip, $port){
$socket = @fsockopen($ip, $port, $errno, $errstr, 0.5);
if($socket === false){
return false;
}
fwrite($socket, "\xfe");
$data = fread($socket, 256);
if(substr($data, 0, 1) != "\xff"){
return false;
}
$data = explode('§', mb_convert_encoding(substr($data, 3), 'UTF8', 'UCS-2'));
return array(
'motd' => $data[0],
'players' => intval($data[1]),
'max_players' => intval($data[2]),
);
}
?>[/syntax]
minecraft server information tut
Re: minecraft server information tut
try adding a dash ( - ) between UTF and 8. Or try removing UTF-2.