toadi has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use LWP::UserAgent; my $ua = new LWP::UserAgent; $ua->agent("PlanetXML/0.1 " . $ua->agent); my $req = new HTTP::Request POST => 'http://geert.dia.pi.be/cgi-bin/xm +lreceive.cgi'; $req->content_type('text/xml'); my $content = slurp("/export/home/geert/xml/XMLS/PXMLStatusMessage.xml +"); $req->content($content); my $res = $ua->request($req); if ($res->is_success) { print $res->content; } else { print "Error\n"; } sub slurp { local $/ = undef; local *X; open X, $_[0] or die "Can't open $_[0]: $!"; my $slurp = <X>; close X or die "Can't close $_[0]: $!"; $slurp; }
To get the contents of my xml.$content=<<END; <xml> </xml> END
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Yet another POST question
by toadi (Chaplain) on Jul 19, 2001 at 15:53 UTC | |
|
Re: Yet another POST question
by mitd (Curate) on Jul 20, 2001 at 01:18 UTC | |
by toadi (Chaplain) on Jul 20, 2001 at 11:56 UTC |