如果一個人達到這樣的事情,他已經尋找到了登錄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