When jsoup simulates the login of a user, the verification code is invalid.

when you use Jsoup to simulate the login of a user for the first time, you need to verify the verification code, but it has not been successful. It prompts verification code error

. < hr >
        loginInfo.put("code",getCode(imgUrl));//

        Connection loginCon = Jsoup.connect(loginUrl);
        //  
        Connection.Response loginResponse = loginCon.method(Connection.Method.POST).data(loginInfo).execute();

        System.out.println(loginResponse.body());
< hr >

I first open a connection to save the CAPTCHA picture locally, and then enter the CAPTCHA manually in the console.

then open a new connection, initiate a login request based on the obtained CAPTCHA and login information, and return the original login page indicating CAPTCHA error .

Login requests on the actual page are submitted through the form form.

is it true that the background CAPTCHA will be refreshed on my second request, and if so, how do I get the real-time CAPTCHA?

check the blog for a long time and try to change it, but the login has not been successful. Have you done similar help to point out my problem

Mar.24,2021

the second request wears the Cookie returned by the first request

Menu