Using Jsoup to POST login data

后端 未结 2 1161
死守一世寂寞
死守一世寂寞 2021-01-19 16:12

I\'m trying to log into this website: http://deeproute.com

This is my code.

            Connection.Response res = null;
            Connection homeCo         


        
2条回答
  •  失恋的感觉
    2021-01-19 16:52

    You need to read form before posting! You are missing param subbera=Login.


    public static void main(String[] args) throws Exception {
    
        Connection.Response loginForm = Jsoup.connect("http://deeproute.com/deeproute/default.asp")
                .method(Connection.Method.GET)
                .execute();
    
        Document document = Jsoup.connect("http://deeproute.com/deeproute/default.asp")
                .data("cookieexists", "false")
                .data("name", "username")
                .data("password", "pass")
                .data("subbera", "Login")
                .cookies(loginForm.cookies())
                .post();
    
    }
    

提交回复
热议问题