馬上加入Android 台灣中文網,立即免費下載應用遊戲。
您需要 登錄 才可以下載或查看,沒有帳號?註冊
x
import java.net.*;
import java.io.*;
import java.sql.*;
public class Main{
public static void main(String[] aaa) throws Exception{
AccessJDBCTest ADB = new AccessJDBCTest();
String allmsg="";
HttpURLConnection urlConnection= null;//定義一個HTTP連線
URL url=new URL("http://sis.hust.edu.tw/face/login/login0.asp?sis_login=帳號&pwd=密碼liketeaboy");//定義一串URL
urlConnection=(HttpURLConnection)url.openConnection();//將URL餵給HttpURLConnection
urlConnection.setRequestMethod("GET");//設定參數傳遞方式(GET or POST)
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.connect();//開啟連線
InputStream yahooHTML=urlConnection.getInputStream();//將yahoo的網頁內容儲存下來
BufferedReader br = new BufferedReader(new InputStreamReader(yahooHTML));
String str = "";
String strID="";
String p1="",p2="",p3="";
int count =9;
while((str = br.readLine()) != null){
//System.out.print(str);
allmsg += str;
int Loc = str.indexOf("input");
if (Loc != -1){
count++;
if ((Loc = str.indexOf("name",Loc+1)) != -1){
if ((Loc = str.indexOf("\"",Loc+1)) != -1){
strID = str.substring(Loc+1,Loc+3);
if (strID.equals("id")){
//把id的value抓出來
p2 = "kkk";
}else if(strID.equals("pw")){
//把pwd的value抓出來
p3 = "666";
}
}
}
}
}
ADB.insertTable(p1+count,p2,p3);
br.close();
}
}
這個是java撈資料程式....
其實我是想問各位大大,要怎麼用寫好的撈資料程式從登入驗證帳密→超連結→超連結→超連接→到要撈的資料
<html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=big5"></head> <body> <form name="form3" method="post"> <input type="hidden" name="id" value="-1"> <input type="hidden" name="pwd" value="1wEWKwrCP83reK7KcQyql3XhOLkd228Rid9mLgZb+9EGNQYPZ1dFxF1VcbSD9q7e"> <input type="hidden" name="submit1" value="login"> </form> <script> document.form3.action="http://sis.hust.edu.tw/face/login/login2.asp"; document.form3.submit(); </script> </body></html>
Process completed.
這是我用撈資料程式撈系統登入的地方的訊息
但是我不知道怎麼利用解析好的ID、PW的value來進行驗證,然後呼叫下個點選的超連結按鈕....
如果知道的大大請給我個解決答案....小弟會非常感謝你的..... |