user171078
01-02-2010, 12:14
Как сделать авторизацию на сайте используя perl ,я пишу некоторый код и Вы видите html код сайта:
#!/usr/bin/perl
use WWW::Mechanize; use strict;
print "Content-type: text/html\n\n";
my $username = "user";
my $password = "pass";
my $outfile = "out.txt";
my $mech = WWW::Mechanize->new( );
my $url = 'http://www.olx.com/login.php';
$mech->get($url);
$mech->form_name('loginform');
$mech->field(username => "$username");
$mech->field(passwd => "$password");
$mech->click();
my $response = $mech->content();
print $response;
html code:
html code: <div id="login" class="clearfix page"> <h1>Sign in</h1> <form id="loginform" name="loginform" action="login.php?a=10" method="post" class="cbb alignleft" onsubmit="document.getElementById('submit').value='Wait...';document.getElementById('submit').disabled=true;"> <h3>Already a member</h3> <p> <input type="hidden" name="c" value=""> <input type="hidden" name="partner" value=""> <label for="username"><span>Username or Email:</span> <input type="text" name="username" id="username" maxlength="100" value="" /></label> </p> <p><label for="password"><span>Password:</span> <input type="password" name="password" id="password" maxlength="12" /></label></p> <p><label for="rememberme"><span> </span> <input type="checkbox" name="rememberme" id="rememberme" /> <small><small>Remember me</small></small></label></p> <p><label for="submit"><span> </span> <input type="submit" name="_btnSubmit" class="submit" id="submit" value="Sign in" /></label> <a href="/lostpassword.php"><small>Forgot your password?</small></a></p> </form>
#!/usr/bin/perl
use WWW::Mechanize; use strict;
print "Content-type: text/html\n\n";
my $username = "user";
my $password = "pass";
my $outfile = "out.txt";
my $mech = WWW::Mechanize->new( );
my $url = 'http://www.olx.com/login.php';
$mech->get($url);
$mech->form_name('loginform');
$mech->field(username => "$username");
$mech->field(passwd => "$password");
$mech->click();
my $response = $mech->content();
print $response;
html code:
html code: <div id="login" class="clearfix page"> <h1>Sign in</h1> <form id="loginform" name="loginform" action="login.php?a=10" method="post" class="cbb alignleft" onsubmit="document.getElementById('submit').value='Wait...';document.getElementById('submit').disabled=true;"> <h3>Already a member</h3> <p> <input type="hidden" name="c" value=""> <input type="hidden" name="partner" value=""> <label for="username"><span>Username or Email:</span> <input type="text" name="username" id="username" maxlength="100" value="" /></label> </p> <p><label for="password"><span>Password:</span> <input type="password" name="password" id="password" maxlength="12" /></label></p> <p><label for="rememberme"><span> </span> <input type="checkbox" name="rememberme" id="rememberme" /> <small><small>Remember me</small></small></label></p> <p><label for="submit"><span> </span> <input type="submit" name="_btnSubmit" class="submit" id="submit" value="Sign in" /></label> <a href="/lostpassword.php"><small>Forgot your password?</small></a></p> </form>