So i have created this code that is grabing info from a server, the string that it is giving me has these specail charecters that i need to get rid of, then I need to exploade it by another.
Here is my code:
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 = mb_convert_encoding(substr($data, 3), 'utf-8', 'UCS-2');
var_dump($data);
/*return array(
'motd' => $data[0],
'players' => intval($data[1]),
'max_players' => intval($data[2]),
);*/
}
and here is the string that i am geting: string(46) "§4Mine§bMad §4Multi-World §f[1.5.1]§3§15"
I need to take out the Â's the 4's the lower case b and f and i need to explode it by the §, but I know how to explode it bye that but first I need to take out the other stuff.