How to retrieve cookie value as string from login request using JSOUP?

Viewed 10

I've requirement to pass below cookie value from picture as below using JSOUP library

Connection.Response response2 = Jsoup.connect("https://www.valueresearchonline.com/funds/26123/motilal-oswal-flexi-cap-fund-regular-plan")
                .timeout(15000)
                .userAgent("Mozilla")
                .header("Cookie", "PHPSESSID=6d9v48p1i5lpgm7pi75agXXXX")
                .method(Connection.Method.GET)
                .execute();

I tried to get cookie value from login API as below but it's not working

Connection.Response response1 = Jsoup.connect("https://www.valueresearchonline.com/login/?")
                .timeout(15000)
                .userAgent("Mozilla")
                .data("username", "valid_email")
                .data("password", "valid_password")
                .method(Connection.Method.POST)
                .execute();
        System.out.println(response1.statusCode());
        System.out.println(response1.cookies().values());

But I'm not getting how to retrieve cookie value as string which can be used in header ?

enter image description here

0 Answers
Related