in reply to Question: Send a chunk of XML to a server

this is not like a typical HTTP form POST

It's easiest to make it one. Pick a param name (say "request") and set that for the value of the param. Then you can just use $cgi->param('request') on the server side to obtain the XML.

Replies are listed 'Best First'.
Re^2: Question: Send a chunk of XML to a server
by lihao (Monk) on Nov 09, 2009 at 18:06 UTC
    But I can not change the server-side code which was written in PHP by other developers, and they wanted me to send exactly that XML data to the server. sounds to me that it can not be handled by a form POST.

      I was trying to save you some trouble writing the server. Since that's already done, just use

      my $response = $ua->post( 'http://...', Content_Type => 'application/xml', Content => $xml, );
      Or if you need to twiddle with the request object,
      use HTTP::Common::Request qw( POST ); my $request = POST( "http://...", Content_Type => 'application/xml', Content => $xml, ); my $response = $ua->request($request);

      sounds to me that it can not be handled by a form POST.

      Of course you can't avoid using a form by using a form. I fail to see your point.