如何将我的用户名和密码发布到网页上?
我想用 Perl 将我的用户和密码发布到网站上。登录页面的来源是:
<div class="top">Sign In</div>
<div class="row"><label for="username">Username:</label></div>
<div class="row"><div id="login:usernameContainer">
<input id="login:usernameContainer:username" type="text"
name="login:usernameContainer:username" class="username" size="16" />
</div></div>
<div class="row"><label for="password">Password:</label></div>
<div class="row"><div id="login:j_id598">
<input id="login:j_id598:password" type="password"
name="login:j_id598:password" value="" size="16" class="password" />
</div></div>
<div class="clearfix">
<div class="row rememberme">
<input id="login:rememberme" type="checkbox"
name="login:rememberme" class="rememberme" />Remember Me
</div>
<div class="submit-button">
<input type="image" src="/beta/style/shun/base/base/en/text/button/button-login.gif"
name="login:j_id603" />
</div>
</div>
我要做什么来发布我的用户和密码?
提前致谢。
I want to post my user and password with Perl to a website. The source of the login page is:
<div class="top">Sign In</div>
<div class="row"><label for="username">Username:</label></div>
<div class="row"><div id="login:usernameContainer">
<input id="login:usernameContainer:username" type="text"
name="login:usernameContainer:username" class="username" size="16" />
</div></div>
<div class="row"><label for="password">Password:</label></div>
<div class="row"><div id="login:j_id598">
<input id="login:j_id598:password" type="password"
name="login:j_id598:password" value="" size="16" class="password" />
</div></div>
<div class="clearfix">
<div class="row rememberme">
<input id="login:rememberme" type="checkbox"
name="login:rememberme" class="rememberme" />Remember Me
</div>
<div class="submit-button">
<input type="image" src="/beta/style/shun/base/base/en/text/button/button-login.gif"
name="login:j_id603" />
</div>
</div>
What am I going to do to post my user and password?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用适当的字段名称(您可以在您发布的 HTML 中找到它们)并为您用来发布到页面的任何 Perl 代码填充表单值(WWW::Mechanize 或您使用的任何其他内容)
You use appropriate field names (you can find them in the HTML you posted) and populate the form values for whatever Perl code you use to post to the page (WWW::Mechanize or whatever else you use)
请参阅http://search.cpan.org/dist/WWW -Mechanize/lib/WWW/Mechanize.pm 有关该模块的详细信息,但这里有一个尝试:
如果它不适合您,或者字段始终具有不同的名称等,请尝试使用
$mech->find_link
使用正则表达式并使用返回的值更改您需要的字段,然后提交表单。希望这有帮助
See http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm for details on the module, but here's a stab at it:
If it doesn't work for you, or the fields have always different names or such, try using
$mech->find_link
with a regex and use the returned values to change the fields you need, then submit the form.hope this helps