English   German
  #1  
Old 27-08-2002, 11:23
Makull Makull is offline
-= TeamSpeak User =-
 
Join Date: Jun 2002
Location: The Netherlands
Posts: 18
Makull is on a distinguished road
Teamspeak 2 stats script for Perl (simple)

Here is a Perl script I made to capture the stats the new 2.x server sends. I don't know where to place a second stats link in the ini file (you could in v1 but it doesn't seem to be in v2) so I altered the PostURL value in the ini file to point to my own script).

Here is the script :
Code:
#!/usr/bin/perl
# 
# This file will save the statistics from TeamSpeak 2 to a local file
#                  

use strict;
use warnings;
use Fcntl ":flock";
use CGI;
# which path did we start from?
$0 =~ m/(.*)(\\|\/)/;           
my $pathprogram = $1;
# save in @INC
push (@INC, $pathprogram);

# the filename to use for the stats
my $stats_file = 'stats.received';
# create CGI object
my $query = new CGI;
# open the stats file for writing
open(FILE, ">$pathprogram/$stats_file") || die("Couldn't open file $stats_file : $!\n");                               
        flock(FILE, LOCK_EX);
                # write all key/value pairs to the file
                foreach my $item ($query->param) {
                    print FILE $item."=".$query->param($item)."\n";
                }
        flock(FILE, LOCK_UN);
close(FILE);

# in case the server requires scripts to send something back, just send a HTML header
print "Content-Type: text/html\n\n";        
# Done
and here is an example of what you will get in the stats.received file :

server_adminemail=na
server_isplinkurl=na
server_ispname=Private
server_ispcountry=Earth
server_platform=Linux
server_version_major=2
server_version_minor=0
server_version_release=17
server_version_build=17
server_port=8767
server_name=Makull's BabbleBox
server_uptime=783
server_password=1
server_type1=clan
server_type2=freeware
clients_current=0
clients_maximum=10
channels_current=1
server_queryport=51234

You can then use a SSI or whatever to include this info on a webpage.
Reply With Quote
  #2  
Old 27-08-2002, 16:21
ScratchMonkey ScratchMonkey is offline
-= TeamSpeak Addict =-
 
Join Date: Jun 2002
Location: Northern California
Posts: 350
ScratchMonkey is on a distinguished road
As a rule, use -wT in the shebang line, to get Taint mode turned on. (This doesn't normally work in Windows Perl, though. See the Active State site for more info on how to deal with that.)

Also note that there's a separate forum for Webpost/scripts, as those will be common to the Linux and Windows servers.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:59.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Add to Bookmarks   |   Printview   |   Contact Us   |   Legal Notices