i want to login ( stable ) with perl to a web site like http://site/signin/index.php.
this page have form and submit without name.
how can i login ?
this is a example code to login:
my $mech = WWW::Mechanize->new();
$mech -> cookie_jar(HTTP::Cookies->new());
$mech -> get($login_url);
$mech -> form_name('theform');
$mech -> field ('username' => $username);
$mech -> field ('password' => $password);
$mech -> click ('log in');
print $mech-> content();
this is my form
<form method="post" action="">
<table id="regform" cellspacing="5">
<tr>
<td class="regparam">email:</td>
<td><input type="text" name="email" value="" tabindex="1" maxlength="100" style="font-family: Tahoma; font-size: 10pt; font-weight: bold; border: 1px solid #9AD7F8; background-color: #ffffff" class="reginp" /></td>
</tr>
<tr>
<td class="regparam">password:</td>
<td><input type="password" name="password" value="" tabindex="2" maxlength="100" style="font-family: Tahoma; font-size: 10pt; font-weight: bold; border: 1px solid #9AD7F8; background-color: #ffffff" class="keyboardInput" /></td>
</tr>
<tr>
<td></td>
<td valign="middle">
<button type="submit" style="font-weight:bold; tabindex="4" class="subm-posts">login</button>
<label style="margin:0px; padding:0px; margin-left:10px; margin-top:7px; float:left; clear:none;">
<input type="checkbox" name="rememberme" value="1" tabindex="3" />
<span style="padding:2px; padding-left:5px;">remember me</span>
</label>
</td>
</tr>
</table>
</form>
Instead of referring to the form by name, you can refer to it by number, i.e. where it appears in the form:
Form numbers start from one.
Similarly, as there is only one button in the form, you can just use
and that will submit the form as it will click the button.