Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我的登录过程工作不正常_Java_Android_Jsoup - Fatal编程技术网

Java 我的登录过程工作不正常

Java 我的登录过程工作不正常,java,android,jsoup,Java,Android,Jsoup,我正在尝试访问一些需要先登录的页面文本 登录页面为= 到目前为止我的尝试是这样的 Response res = Jsoup .connect("https://utdirect.utexas.edu/") // this is the login page .header("LOGON", "mySchoolID") .header("PASSWORDS", "mySchoolIDPassword") .method(Method.

我正在尝试访问一些需要先登录的页面文本

登录页面为=

到目前为止我的尝试是这样的

Response res = Jsoup
        .connect("https://utdirect.utexas.edu/") // this is the login page
        .header("LOGON", "mySchoolID")
        .header("PASSWORDS", "mySchoolIDPassword")
        .method(Method.POST)
        .execute();


    Map<String, String> loginCookies = res.cookies(); // cookies to keep me logged in



    // This is the page that required me to be loged in first
    Document doc =   Jsoup.connect("https://utdirect.utexas.edu/apps/degree/audits/requests/history/") 
            .cookies(loginCookies).get();
        Elements e = doc.getAllElements();

        for(Element e1 : e){
            Log.i("e.text()" , e.text);
        }
Response res=Jsoup
.连接(“https://utdirect.utexas.edu/“”//这是登录页面
.header(“登录”、“mySchoolID”)
.header(“密码”、“mySchoolIDPassword”)
.method(method.POST)
.execute();
Map loginCookies=res.cookies();//让我登录的cookies
//这是需要我首先登录的页面
Document doc=Jsoup.connect(“https://utdirect.utexas.edu/apps/degree/audits/requests/history/") 
.cookies(loginCookies.get();
元素e=doc.getAllegements();
用于(元素e1:e){
Log.i(“e.text()”,e.text);
}
问题是打印出来的是登录页面,而不是我想要的页面


你知道这个问题的解决方法吗?

在发布之前先阅读登录表。您缺少几个参数。每次登录都要检查它们


Connection.Response loginForm=Jsoup.connect(“https://utdirect.utexas.edu/")
.ignoreContentType(true)
.userAgent(“Mozilla/5.0(Windows NT 6.1;Win64;x64;rv:25.0)Gecko/20100101 Firefox/25.0”)
.推荐人(”http://www.google.com")
.超时(12000)
.followRedirects(true)
.method(Connection.method.GET)
.execute();
Connection.Response loginFormFilled=Jsoup.connect(“https://utdirect.utexas.edu/")
.ignoreContentType(true)
.userAgent(“Mozilla/5.0(Windows NT 6.1;Win64;x64;rv:25.0)Gecko/20100101 Firefox/25.0”)
.followRedirects(true)
.推荐人(”https://utdirect.utexas.edu/")
.数据(“CDT”,“20140103191944”)
.data(“新密码”,“新密码”)
.data(“确认新密码”和“”)
.数据(“登录”、“用户”)
.数据(“密码”、“通行证”)
.cookies(loginForm.cookies())
.method(Connection.method.POST)
.execute();
映射cookies=loginFormFilled.cookies();

我如何准确地保存这些cookies以便访问?提前谢谢!
    Connection.Response loginForm = Jsoup.connect("https://utdirect.utexas.edu/")
                .ignoreContentType(true)
                .userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0")
                .referrer("http://www.google.com")
                .timeout(12000)
                .followRedirects(true)
                .method(Connection.Method.GET)
                .execute();

    Connection.Response loginFormFilled = Jsoup.connect("https://utdirect.utexas.edu/")
                .ignoreContentType(true)
                .userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0")
                .followRedirects(true)
                .referrer("https://utdirect.utexas.edu/")
                .data("CDT","20140103191944")
                .data("NEW_PASSWORD", "")
                .data("CONFIRM_NEW_PASSWORD", "")
                .data("LOGON", "user")
                .data("PASSWORDS", "pass")
                .cookies(loginForm.cookies())
                .method(Connection.Method.POST)
                .execute();

     Map<String, String> cookies = loginFormFilled.cookies();