Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

nerfherder's scratchpad

by nerfherder (Monk)
on Jan 24, 2005 at 10:32 UTC ( #424550=scratchpad: print w/ replies, xml ) Need Help??

#!/usr/bin/perl use strict; #use warnings; #use diagnostics; use CGI; my $query = new CGI; print $query->header(); use IO::Socket::INET; print "<main>"; print "<title> UPS Status </title>"; my $sock = new IO::Socket::INET->new(PeerPort=>20100, Proto=>'udp', PeerAddr=>'207.210.215.108') or die "something we +nt wrong: $! "; my $request = "\xff\xff\xff\xff\x67\x65\x74\x69\x6e\x66\x6f\x20\x78\x7 +8\x78"; $sock->send($request); my $text; $sock->recv($text,235); my ($maxclients, $clients, $gametype, $mapname, $needpass); $text =~ s/\\/ /g; my @data = split(' ', $text); my $count = 0; foreach (@data) { chomp; if ($_ =~ m/sv_maxclients/) { print "<maxclients> $data[($count+1)] </maxclients>"; } if ($_ =~ m/clients/ && !($_ = m/sv_maxclients/)) { print "<players> $data[($count+1)] </players>"; } if ($_ =~ m/gametype/) { print "<gametype> $data[($count+1)] </gametype>"; } if ($_ =~ m/mapname/) { print "<mapname> $data[($count+1)] </mapname>"; } if ($_ =~ m/needpass/) { print "<needpass> $data[($count+1)] </needpass>"; } $count++; } print "</main>";
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2014-12-27 11:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls