Have have a small program using LWP to do a Post. The response is XML. Here is my program...
use LWP::UserAgent; use HTTP::Request::Common qw(POST); my $ua = LWP::UserAgent->new() || die "Unable to create new UserAgent +object"; my $url = 'http://cosmias02d.mwh.com:7778/reports/rwservlet'; my %form_data = ( SERVER => 'repcosmias02d', USERID => 'mwh/prahd@dev', REPORT => 'ap_daily_jrnl.rep', DESTYPE => 'PRINTER', DESNAME => 'cohpisd012', DESFORMAT => 'hplwide', STATUSFORMAT => 'xml' ); my $request = POST($url, \%form_data); my $response = $ua->request($request); $response->remove_header(); $content = $response->as_string(); print "$content\n";
The response is
HTTP/1.1 200 OK
Cache-Control: private
Connection: close
Date: Tue, 09 Sep 2003 23:08:26 GMT
Server: Oracle9iAS/9.0.2 Oracle HTTP Server
Content-Language: en
Content-Type: text/xml
Client-Date: Tue, 09 Sep 2003 23:08:27 GMT
Client-Peer: 172.25.209.185:7778

<?xml version = '1.0' encoding = 'ISO-8859-1' standalone = 'yes'?>
<serverQueues>
   <job id="117" queueType="past">
      <name>ap_daily_jrnl.rep</name>
      <type>report</type>
      <status code="4">Finished successfully</status>
      <owner>RWUser</owner>
      <server>repcosmias02d</server>
      <destination>
         <desType>PRINTER</desType>
         <desName>cohpisd012</desName>
         <desFormat>unknown</desFormat>
         <file>39872723.txt</file>
      </destination>
      <timingInfo>
         <queued>9/9/03 4:08 PM</queued>
         <started>9/9/03 4:08 PM</started>
         <finished>9/9/03 4:08 PM</finished>
      </timingInfo>
   </job>
</serverQueues>
What is the best way to strip off the header section so I can pass the xml document into an xml parser?

edited: Wed Sep 10 02:41:28 2003 by jeffa - code tags for code (left the pre tags for response)


In reply to What is the best way to get the response payload by mifflin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.