[求助]请大虾帮我看下这个注册程序到底问题出在哪里?
sub register_mode {my $user_reg = shift;
my $strPassword = shift;
$user_reg = 'testsf' . time() . '?' unless $user_reg;
$strPassword = '123456' unless $strPassword;
my $total = 1;
$total = 999 if $user_reg =~ m{\?};
for my $n (1..$total) {
my $strUsername = $user_reg;
my $f_n = sprintf("%03d", $n);
$strUsername =~ s{\?}{$f_n}gis;
my $backurl = 'http://cqbbs.';
my $question2 = '第一个宠物的名字';
my $strAnswer ='1234567890';
my $Gender = '男';
my $strEmail = rock1_23@';
my $strProvince = '上海';
my $strCity = '上海';
my $strDistrict = '闵行';
my $ua = LWP::UserAgent->new;
$ua->cookie_jar({});
#my $r1 = $ua->get('http://passport.');
#print Dumper($r1);
my_print "准备注册$strUsername\n" if VERBOSE;
my $r2 = $ua->get('http://passport.', Referer => 'http://passport.');
open(FILE, '>', 'ipc/zhuce.txt');
close FILE;
open(FILE, '>', 'ipc/zhuce.jpg');
binmode FILE;
print FILE $r2->content;
close FILE;
my_print "等待银币验证码识别\n" if VERBOSE;
my $text = '';
open(FILE, '<', 'ipc/zhuce.txt');
while (1) {
$text = <FILE>;
$text =~ s{\r|\n}{}g if defined $text;
unless ($text) {
# my_print "." if VERBOSE;
sleep 1;
next;
}
if ($text eq 'cancel') {
my_print "用户取消验证码\n" if VERBOSE;
my_exit;
} else {
last;
}
}
close FILE;
unless ($text) {
my_print "验证码有误\n" if VERBOSE;
next;
}
my_print "得到输入验证码$text\n" if VERBOSE;
my $response = $ua->post('http://passport.', Referer => 'http://passport.',
Content => [
backurl => 'http://cqbbs.',
projname => '',
strUsername => $strUsername,
strPassword => $strPassword,
strPasswordConfirm => $strPassword,
question2 => $question2,
strQuestion => '',
strAnswer => $strAnswer,
Gender => $Gender,
strEmail => $strEmail,
strProvince => $strProvince,
strCity => $strCity,
strDistrict => $strDistrict,
agree => 'on',
vcode => $text,
'submit.x'=>24,
'submit.y'=>7
],
);
if ($response->content =~ m{您已成功申请了搜房通行证}) {
my_print "成功注册$strUsername\n" if VERBOSE;
open(FILE2, '>>', 'user_get.txt');
print FILE2 "$strUsername/$strPassword\n";
close FILE2;
} else {
my_print "不能注册$strUsername\n" if VERBOSE;
}
}
# print Dumper($response);
#sleep 100;
close FILE2;
}
注册连接: http://passport.