On Today at 2:17pm, RAA=>Roderick A. Anderson <[EMAIL PROTECTED]> wrote:

RAA> [..snipped..]
RRA>
RAA> Anyone on the list have code they're willing/able to share doing HTTP
RAA> POSTs (of XML documents)?
RAA> 
RAA> 
RAA> Thanks,
RAA> Rod
RAA> 

Try something like:

#!/usr/bin/perl -Tw

use strict;

use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
            # user agent
my $ua = new LWP::UserAgent;
            # request
my $req;
            # response
my $res;
            # URL
my $url = 'http://pathtourl/';
            # formulate a POST request
$req = POST $url;
            # set content-type
$req->content_type("text/xml");
            # XML content
$req->content(<<EOT);
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZHR0002X>
  <PersonnelNumber>Blah</PersonnelNumber>
  <LastName>BlahLast</LastName>
  <EEStatus>A</EEStatus>
  <Initials>Y</Initials>
</ZHR0002X>
EOT

            # make request and get response back
$res = $ua->request($req);
            # print the response
print $res->is_success ? $res->content :
    'Error while getting ' . $res->request->uri . "\n" . $res->status_line;


--
Haroon Rafique
<[EMAIL PROTECTED]>

Reply via email to