Hi,

I have a small script trying to login into a website. Of course they use forms and cookies for that. Unfortunately does my code not work. If tried many approaches but without success. One thing I recognized is, that $ua->post() sends "Content-length: 0" header with the request. Which I find quite strange. Please see my script and sample output below.

What do I do wrong?

Running on Linux, Perl 5.8.3, LWP 5.76.

Thanks

Ulrich


use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");
my $res = $ua->post('http://search.cpan.org/search', (perl test2 query=>'libwww-perl',mode=>'dist'));
print $res->request->as_string;
print;


Sample output:
POST http://search.cpan.org/search
User-Agent: MyApp/0.1 libwww-perl/5.76
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
Mode: dist
Query: libwww-perl

Reply via email to