hi, I'm working on a CGI page which constructs XML data, puts it into a scalar variable and posts it to a different website , where an ASP page receives the data and sends back an acknowledgement. The website which I'm posting to, requires that I pass a username and password in the URL (without which it generates an error "Username not sent in the posted data") Here's the block of the affected code

my $ua = LWP::UserAgent->new; my $remote_server = "100.100.100.100/ReceivingPage.asp?username= +test&password=pwd"; my $req = HTTP::Request->new(GET=>"http://$remote_server"); my $res = $ua->request($req); if ($res->is_success) { $req = HTTP::Request->new(POST=>"http://$remote_server"); + + $req->content_type('application/x-www-form-urlencoded'); my $postvars = $request_xml; $req->content_length(length($postvars)); $req->content($postvars); $res = $ua->request($req); if ($res->is_success) { my $xml_raw = $res->content; my $parsed = eval {XMLin($xml_raw) }; ...


Now my question is that when I'm POSTing the data, will the QueryString variables (username and password) be passed too ? Presently, the web site to which I'm posting the data to keeps complaining that I'm not sending the required Username and password.

Any help would be greatly appreciated...

Edit ar0n -- added code tags


In reply to POSTing QueryString data using LWP::UserAgent by screamingeagle

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.