- 论坛徽章:
- 1
|
回复 1# gknhjqx
#!/usr/bin/perl
use warnings;
use strict;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Cookies;
my $url = 'http://bbs.ep-music.net/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1';
my $cookie_jar = HTTP::Cookies->new(
file => "./cookies.lwp",
autosave => 1,
);
my $ua = LWP::UserAgent->new;
my $cookies = $ua->cookie_jar($cookie_jar);
$ua->agent("MyApp/0.1 ");
my $res = $ua->post( $url, [
username => 'perltest',
password => 'perltest',
]
);
print "Post Error!\n" unless $res->is_success;
my $res1 =$ua->get('http://bbs.ep-music.net/forum.php');
print $res1->decoded_content,"\n";
你的入口地址没写对,如楼上所说,拿httpwatch看一下。再者,后边不用重定向
|
|