[Melbourne-pm] LWP::UserAgent to post to web form

Peter Machell peter at machell.net
Wed Nov 15 00:10:50 PST 2006

Newbie alert. Help appreciated.

I'm trying to script data to send to a web form.

Please point me in the right direction if LWP::UserAgent is not an  
appropriate way to do this.

The code below is hitting the server but not sending a POST request.   
$ua returns LWP::UserAgent=HASH(0x82d0ab0)

Thanks in advance,



use strict;
use HTTP::Request::Common;
use LWP::UserAgent;

my($ua) = LWP::UserAgent->new;

my($url) = 'http://foo.com/';

my($send) = $ua->request(POST $url,
         Content_Type => 'form-data',
         Content      =>
                 userid          =>      'test',
                 firstname       =>      'Test',

More information about the Melbourne-pm mailing list