Is there a way without using ventrilo_status?

A TeamSpeak 2 server monitor addon based on gllcTS2, and Ventrilo server monitor

Moderator: mdeshane

Re: Is there a way without using ventrilo_status?

Postby PleegWat » Sun Sep 13, 2009 12:40 pm

You say the string you quoted is 'as it is in the browser'. Can you use the view source option and verify? I'd expect each property is on its own line, so you can actually just explode($statusstring, "\n") to get each key+value in an array member, then parse those pairs.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Is there a way without using ventrilo_status?

Postby mdeshane » Sun Sep 13, 2009 4:25 pm

Thank you Pleeg! I completely forgot to try and use a newline as a delimiter. That gave me an idea that works perfectly!

Code: Select all
$tempres = str_replace("\n", "&", trim($response));
$tempres2 = str_replace(":", "=", $tempres);
parse_str($tempres2, $res);
print_r($res);


Which gives me a lovely output of:
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= )


So much less code, and so simple.
Image
Accounts Addon - Roster v2 User Account Addon

PKC Dev Site - http://dev.pkcomp.net
My Roster Dev Site - http://myroster.dontexist.net
User avatar
mdeshane
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 203
Joined: Sun Dec 10, 2006 4:54 am
Location: Grand Rapids, MI USA
Realm: Khadgar (PvE) - US

Re: Is there a way without using ventrilo_status?

Postby AnthonyB » Sun Sep 13, 2009 11:19 pm

mdeshane wrote:What Detail Mode are you using and what PHP version are you running?


Detail Mode = 2
PHP = 5.2.10
Roster 2.0.2 svn [latest] latest trunk SVN svn [latest] running on IIS7/Windows Server 2008 SP2 | MySQL 5.0.85 | PHP 5.2.10 | Yes, Roster and PHP rocks on IIS! Even run as FastCGI extension!
User avatar
AnthonyB
Gimpy Developer
Gimpy Developer
 
Posts: 346
Joined: Tue Jul 04, 2006 2:44 pm
Location: Sydney, Australia

Re: Is there a way without using ventrilo_status?

Postby mdeshane » Fri Sep 18, 2009 5:41 pm

Ok, found a little snafu in the new parsing. Though it would of been worse with the old parsing that didn't work. The problem is having multiple clients on the server. The parser only adds the last client to the array. All clients before that aren't added. I think we may have to play with preg_replace for the client parsing, but I'm open to suggestions. Data and code to play with are below.

The String (with 2 clients in detail mode 2)
Code: Select all
$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=';


The String (with 2 clients in detail mode 7)
Code: Select all
$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';


The Parser (for detail mode 2)
Code: Select all
// 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);


The Parser (for detail mode 7)
Code: Select all
$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);
Image
Accounts Addon - Roster v2 User Account Addon

PKC Dev Site - http://dev.pkcomp.net
My Roster Dev Site - http://myroster.dontexist.net
User avatar
mdeshane
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 203
Joined: Sun Dec 10, 2006 4:54 am
Location: Grand Rapids, MI USA
Realm: Khadgar (PvE) - US

Re: Is there a way without using ventrilo_status?

Postby mdeshane » Fri Sep 18, 2009 10:30 pm

Nevermind... I figured it out, just had to seperate the CLIENT parts into another array.
Image
Accounts Addon - Roster v2 User Account Addon

PKC Dev Site - http://dev.pkcomp.net
My Roster Dev Site - http://myroster.dontexist.net
User avatar
mdeshane
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 203
Joined: Sun Dec 10, 2006 4:54 am
Location: Grand Rapids, MI USA
Realm: Khadgar (PvE) - US

Re: Is there a way without using ventrilo_status?

Postby AnthonyB » Fri Dec 25, 2009 10:30 am

just wondering if this ever got to a completed state?
Roster 2.0.2 svn [latest] latest trunk SVN svn [latest] running on IIS7/Windows Server 2008 SP2 | MySQL 5.0.85 | PHP 5.2.10 | Yes, Roster and PHP rocks on IIS! Even run as FastCGI extension!
User avatar
AnthonyB
Gimpy Developer
Gimpy Developer
 
Posts: 346
Joined: Tue Jul 04, 2006 2:44 pm
Location: Sydney, Australia

Re: Is there a way without using ventrilo_status?

Postby mdeshane » Thu Dec 31, 2009 8:51 am

Hasn't made it to a completed state. I got lost in trying to combine the interface for TeamSpeak with Ventrilo. I have everything to parse the server info. I just need to clean it up and maybe write a new interface altogether. As the gllc script has alot of messy code.
Image
Accounts Addon - Roster v2 User Account Addon

PKC Dev Site - http://dev.pkcomp.net
My Roster Dev Site - http://myroster.dontexist.net
User avatar
mdeshane
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 203
Joined: Sun Dec 10, 2006 4:54 am
Location: Grand Rapids, MI USA
Realm: Khadgar (PvE) - US

Previous

Return to GuildSpeak

Who is online

Users browsing this forum: No registered users and 0 guests

cron