如果一个人达到这样的事情,他已经寻找到了登录HTML源。在这种情况下,它表明:
<form name="FrontPage_Form1" action="user_login.asp" method="post" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" id="login-form">
<fieldset>
<p><label for="login-username">username</label>
<input id="login-username" autofocus="" class="round full-width-input" name="username" size="32" value="" type="text">
</p><br>
<p><label for="login-password">password</label>
<input id="login-password" class="round full-width-input" name="password" size="32" value="" type="password">
</p><br>
<p>
<input value="1" name="remember" =""="" type="checkbox">Remember Me</p><br>
<input name="redirect" value="http://stackoverflow.com/questions/25782351/unable-to-log-in-to-webpage-using-xmlhttp" type="hidden">
<p>I've <a href="user_forgotpassword.asp">forgotten my password</a>.</p>
<br><br>
<input name="submit" value="Login" class="button round blue image-right ic-right-arrow" type="submit">
or
<a href="user_signup.asp" class="button round blue image-right ic-right-arrow">
REGISTER NOW</a> </fieldset>
</form>
因此,有在提交POST以下元素:
- 的用户名与用户名的值
- 密码,密码为值
- 重定向一个网址作为值
- 以“登录”提交作为值
请注意,这是表单元素的名称。
“记住”复选框不是默认情况下提交,因为它是一个复选框,只有提交,如果它被检查。
也许该网站只接受在POST中包含所有默认元素的登录信息。如果是这样那么尝试:
oHttp.send "[email protected]&password=passss&redirect=http%3A%2F%2Fwww.example.com&submit=Login"
注意,在重定向的URL必须是网址为所需类型application/x-WWW的形式进行了urlencoded编码。
此外,也许该网站试图阻止自动登录。那么你应该尊重那个。
问候
阿克塞尔
看在登录页面的源代码。还有更多的表单元素,这些元素通常会被发送。因此,重定向= [网址编码的URL]和提交=登录。也许该网站只接受在POST中包含所有默认元素的登录信息。也可能该网站试图阻止自动登录。那么你应该尊重那个。 – 2014-09-11 09:26:07
@AxelRichter感谢您的快速帮助,你能帮助我如何添加代码重定向和提交=登录,我是XHTML的新手。 – Excelliot 2014-09-11 09:41:04