I am trying to do a login in www.forocoches.com and get the cookies for next transactions but its impossible! :/
I am using this code for get the cookie
Connection.Response res = null;
String url = "http://www.forocoches.com/foro/forumdisplay.php?f=2";
print("Fetching %s...", url);
Map<String, String> loginCookies = null;
try {
res = Jsoup.connect(url)
.data("cookieexists", "false")
.userAgent("Mozilla/5.0")
.timeout(100000)
.data("vb_login_username", "userlogin")
.data("vb_login_password", "userpassword")
.method(Method.POST)
.execute();
} catch (IOException e) {
e.printStackTrace();
}
loginCookies = res.cookies();
And i am using this for use the cookies
Document doc2 = Jsoup.connect(url2).userAgent("Mozilla/5.0").timeout(100000).cookies(loginCookies).get();
I think that the problem is when i try to get the cookie because the webpage have different forms and the correct is the one who name "log".
Could you help me?
Thanks!