You are looking at posts that were written on October 22nd, 2006.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Sep | Nov » | |||||
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | |||||
Posted on October 22nd, 2006 by Chris Farris.
Categories: perl.
This took way to long to lookup how to do.
This issues a POST command to a cgi ($url), fetches the resulting content back and then parses the XML data.
use XML::Simple;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST => $url);
$req->content_type('application/x-www-form-urlencoded');
$req->content("Mac_Id=$mac");my $res = $ua->request($req);
my $xml = $res->content;# Parse cfgdata
my $xsl = XML::Simple->new();
my $config = eval { $xsl->XMLin($xml)} ;
if($@) { # bad XML
print "Invalid XML for $mac\n";
print ERROR "Invalid XML for $mac\n";
next;
}
Powered by WordPress
© 2006 by Chris Farris. All rights reserved.
Background is Sky Song by Digital Blasphemy
Page Designed based on Vistered Little.