doing a POST request with LWP
Matija Grabnar (Matija.Grabnar@arnes.si)
Mon, 22 Mar 1999 18:26:07 +0100
Apologies if this is a FAQ - I did read through the manuals, but I didn't
find anything that would help me.
How do I use LWP to make a POST request, i.e. simulate the request sent
by a browser to get a response from a form?
I tried doing a
my $request = new HTTP::Request('POST', 'http://rzenik.arnes.si/cgi-bin/test.c
gi?param=one¶m2=two');
But my query was ignored. I think the culprit is the following line
in LWP/Protocol/http.pm
my $buf = $request_line . $h->as_string($CRLF) . $CRLF;
which constructs the request. From what I sniffed on my ethernet port
when doing requests from the browser, the POST query should be appended
after the last CRLF, but it isn't - the buffer is written in the next step.
A browser first sends the headers (which don't contain the query) then
the double CRLF, then the query itself.
So, what do I have to do to send my query string?
(If the answer is "patch LWP", tell me and I'll do it :-)
--
"My name is Not Important. Not to friends.
But you can call me mr. Important" - Not J. Important
Matija.Grabnar@arnes.si