Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

XML Node Grabber (was (jeffa) 2Re: Reading PerlMonks offline)

by jeffa (Bishop)
on Apr 02, 2002 at 16:01 UTC ( [id://156040]=note: print w/replies, xml ) Need Help??


in reply to (jeffa) Re: Reading PerlMonks offline
in thread Reading PerlMonks offline

This is soooo much better. It should last a lot longer without maintenance as well.
use LWP; use XML::Simple; use HTTP::Request::Common; use strict; use constant URL => 'http://perlmonks.org/index.pl'; my $node = shift; print "USAGE: $0 [node_id]\n" and exit unless $node; my $ua = LWP::UserAgent->new; $ua->agent('node_xml_grabber/1.0 (' . $ua->agent .')'); my $request = POST(URL, Content => [ node_id => $node, displaytype => 'xml', ]); my $response = $ua->request($request) or die "no download id $node"; my $content = $response->content(); my $xml = XMLin($content) or die "xml error!"; my $date = scalar localtime($xml->{ucreatetime}->{content}); print <<EOF; $xml->{title}->{content} by [$xml->{author_user}->{content}] on $date $xml->{doctext}->{content} EOF
Big thanks to Kanji :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://156040]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 14:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found