使用 JSOUP 登录失败

Login failing with JSOUP

我正在尝试登录此网站:https://bostad.stockholm.se/Minasidor/login/ (Press button lösenordskonto to get the right login). I've scanned through the html for the form and I found the action url that is triggered after pressing login: https://login001.stockholm.se/siteminderagent/forms/login.fcc 但是我还没有成功取回任何 cookie。我是否缺少一些必需的 POST 数据?我在哪里可以检查这个?

这是我的代码:

    try {
        //In this url you must login
        //String loginUrl = "https://bostad.stockholm.se/Minasidor/login/";
        String loginUrl = "https://login001.stockholm.se/siteminderagent/forms/login.fcc";


        //First login. Take the cookies
        Connection.Response res = Jsoup
                .connect(loginUrl)
                .data("USER", "user")
                .data("PASSWORD", "pass")
                //.referrer("http://www.google.com")
                .userAgent(
                        "Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                .method(Method.POST).timeout(0).execute();

        Map<String, String> loginCookies = res.cookies();

        System.out.println(res.hasCookie(url));}

打开 Chrome 开发者工具,在控制台中输入 $("input")

在那里你会看到你需要提供给服务器的所有输入,你还需要包括那些HIDDEN FIELDS