Moderator: mdeshane
$tempres = str_replace("\n", "&", trim($response));
$tempres2 = str_replace(":", "=", $tempres);
parse_str($tempres2, $res);
print_r($res);
Array ( [NAME] => GuildSpeak Dev Server [PHONETIC] => GuildSpeak Dev Server [COMMENT] => [AUTH] => 0 [MAXCLIENTS] => 8 [VOICECODEC] => 0,GSM 6.10 [VOICEFORMAT] => 1,11 KHz, 16 bit [UPTIME] => 1881 [PLATFORM] => WIN32 [VERSION] => 3.0.3 [CHANNELCOUNT] => 0 [CLIENTCOUNT] => 1 [CLIENTFIELDS] => ADMIN,CID,PHAN,PING,SEC,NAME,COMM [CLIENT] => ADMIN=0,CID=0,PHAN=0,PING=0,SEC=500,NAME=Mike,COMM= )
mdeshane wrote:What Detail Mode are you using and what PHP version are you running?
$response = 'NAME: GuildSpeak Dev Server PHONETIC: GuildSpeak Dev Server COMMENT: AUTH: 0 MAXCLIENTS: 8 VOICECODEC: 0,GSM 6.10 VOICEFORMAT: 1,11 KHz%2C 16 bit UPTIME: 8310 PLATFORM: WIN32 VERSION: 3.0.3 CHANNELCOUNT: 0 CLIENTCOUNT: 2 CLIENTFIELDS: ADMIN,CID,PHAN,PING,SEC,NAME,COMM CLIENT: ADMIN=0,CID=0,PHAN=0,PING=0,SEC=1471,NAME=Mike,COMM= CLIENT: ADMIN=0,CID=0,PHAN=0,PING=0,SEC=1104,NAME=Chewy,COMM=';
$response = '00GuildSpeak Dev Server 01GuildSpeak Dev Server 02 030 048 050,GSM 6.10 061,11 KHz%2C 16 bit 078374 08WIN32 093.0.3 100 122 13010,020,030,040,051535,06Mike,07 13010,020,030,040,051168,06Chewy,07';
// Replace characters to prep for parse_str()
$tempres = str_replace("\n", "&", trim($response));
$tempres2 = str_replace(":", "=", $tempres);
// Now parse_str() does the rest of the work for us
parse_str($tempres2, $res);
$tempres = str_replace("\n", "&", trim($response));
$temp = "&".$tempres; // Add the & to the start, so the string begins &00
$tempname = str_replace("&00", "NAME=", $temp);
$tempphone = str_replace("&01", "&PHONETIC=", $tempname);
$tempcomm = str_replace("&02", "&COMMENT=", $tempphone);
$tempauth = str_replace("&03", "&AUTH=", $tempcomm);
$tempmaxcl = str_replace("&04", "&MAXCLIENTS=", $tempauth);
$tempvc = str_replace("&05", "&VOICECODEC=", $tempmaxcl);
$tempvf = str_replace("&06", "&VOICEFORMAT=", $tempvc);
$tempuptime = str_replace("&07", "&UPTIME=", $tempvf);
$tempplat = str_replace("&08", "&PLATFORM=", $tempuptime);
$tempver = str_replace("&09", "&VERSION=", $tempplat);
$tempchannct = str_replace("&10", "&CHANNELCOUNT=", $tempver);
$tempclct = str_replace("&12", "&CLIENTCOUNT=", $tempchannct);
$tempcl = str_replace("&13", "&CLIENT=", $tempclct);
parse_str($tempcl, $res);
Users browsing this forum: No registered users and 0 guests