use strict; use Net::HTTP; sub listeners { my $port=shift; #print "Initializing port $port\n"; my $http=Net::HTTP->new(Host=>"localhost",PeerPort=>$port); $http->write_request('GET'=>'/7.html', 'User-Agent'=>'Mozilla/5.0'); #print "Reading in the HTML.\n"; my ($code,$mess,%h)=$http->read_response_headers; my $buff; my $n=$http->read_entity_body($buff,1024); die "Cannot read the buffer. $!" unless defined $n; my ($line) = $buff =~ /<body>(.+)<\/body>/; my @sc=split(/,/,$line); return $sc[0]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A sub to return the number of listeners on a Shoutcast server
by b10m (Vicar) on Jan 02, 2004 at 22:23 UTC | |
by simonm (Vicar) on Jan 03, 2004 at 17:52 UTC | |
by Omeron (Novice) on Jan 04, 2004 at 20:12 UTC |