You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Chris Pizzo <ch...@artinside.com> on 2002/10/22 17:35:28 UTC

How do I handle an XML document sent as a POST [newbie]

I'm trying to figure out how to get the XML document sent to me in a An HTTP
transmission.  The example I'm given is:

HTTP headers:
POST HTTP/1.0
Content-type: text/xml; charset="UTF-8"
Content-length: 1862
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
User-Agent: Java1.1
Host: localhost:8080
Connection: Keep-Alive
<?xml version="1.0" encoding="UTF-8"?>
.
.
.
I have found lots of examples on how to deal with the xml once I have it but
I don't understand how to get the xml document from the post?

Anyone point me in the right direction?

Thanks for your patience,
Chris


Re: How do I handle an XML document sent as a POST [newbie]

Posted by Larry Leszczynski <la...@furph.com>.
Hi Chris -

On Tue, 22 Oct 2002, Chris Pizzo wrote:

> I'm trying to figure out how to get the XML document sent to me in a
> An HTTP transmission.  The example I'm given is:

You can read the POST content directly in your mod_perl handler, e.g.:

sub handler
{
   my $r = shift;
   my $content;
   $r->read($content, $r->header_in("Content-length"));

   # do stuff with $content...
}

See the mod_perl Cookbook recipe 3.6


Larry Leszczynski
larryl@furph.com