Re: doing a POST request with LWP

Ed (ed@chronos.net)
Tue, 23 Mar 1999 09:29:10 +0000 (WET)


On Mon, 22 Mar 1999, Matija Grabnar wrote:
> 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&param2=two');

POST is different from GET. With GET the query is part of the URL,
whereas with POST the query (encoded for instance with x-url-whatever,
as above) is passed as the body of the request. See HTTP::Request::Common
for a slightly simple interface, where you can pass a hash- or
list-ref.

Alternatively, for a proposed even-simpler interface, see my
discussion with Gisle :-)
-- 
Ed          |                         | mailto:ed@chronos.net
Chronos.Net | http://www.chronos.net/ | mailto:info@chronos.net