2012-11-21 55 views
1

我試圖「模擬」按鈕按下並用表單提交用戶名和密碼登錄到源代碼如下的網站。我已經嘗試過這樣的:在Android中使用Jsoup向GET表單提交GET

​​

(autoLogInUsername和autoLogInPassword是String對象)

但這似乎並不想正常工作。我已經在這裏閱讀了堆棧溢出問題,並且我已經嘗試了很多建議,但似乎無法得到此工作。我在想我的問題是表單是GET而不是POST,或者我沒有對提交按鈕做任何事情(但我不知道如何引用它,因爲它沒有名稱)。謝謝你的幫助!

<html> 
<head> 
<title>Login Page</title> 
<FONT FACE="ARIAL" SIZE="5" color="#FF00FF">Twin Rinks Ice Pavilion, Inc. Attendance & Subs Program<BR></font> 
</head> 
<body onLoad="document.forms.myform.subs_data1.focus()"> 
<form name="myform" method="GET" action="subs_entry.php"> 
Username:<input type=text name=subs_data1 size="70" value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(your email address)<br> 
Password:<input type=password name=subs_data2 size="25" value=""><br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<input type=submit value="Login!"> 
<br><br>Leisure next session 
    schedule is done.<br>Bronze next session schedule is done.<br>Silver 
    next session schedule is done<br>Gold 
    next session schedule is done.<br>Platinum next session 
    schedule is done.</form> 
</body> 
</html> 
+0

你讓我在失去「但是這似乎並不想正常工作」,您可以提供LogCat輸出給我們? – jnthnjns

+1

對不起,我應該更清楚。問題是什麼都沒有發生,代碼編譯和運行良好,沒有例外,但據我所知,在我的android應用程序上的webView沒有任何影響。 – TheMasster12

+0

檢查[this out](http://stackoverflow.com/a/6476916/1134705),我認爲這是你的問題。讓我知道。 – jnthnjns

回答

0

您可以直接在您訪問的網站的URL中放置GET信息。 POST會更難,但你沒有處理。

例如,如果你想發送變量x=3y=4foo.com/index.html,你可以簡單地調用

http://www.foo.com/index.html?x=3&y=4