java - Logging in to pastebin using Jsoup -
i'm trying connect pastebin , login. when run this, html doesn't show have logged in , profile id isn't anywhere in script.
response loginresponse; document cur = null; map<string, string> logincookies; loginresponse = jsoup.connect("http://www.pastebin.com/login.php") .data("user_name", name) .data("user_password", pwrd) .data("submit", "login") .method(method.post) .execute(); if (loginresponse != null) { logincookies = loginresponse.cookies(); try { cur = jsoup.connect("http://www.pastebin.com") .cookies(logincookies).get(); } catch (exception e) { e.printstacktrace(); } (map.entry<string, string> entry : logincookies.entryset()) { system.out.println(entry.getkey() + "/" + entry.getvalue()); } string s = cur.body().html(); system.out.println(cur.body().html()); system.out.println(cur.body().html().contains("arhowk")); }
i believe data fields correct, php shows post method being used, should fine. i'm new , see alot of pages answers don't see solutions isuse.
try browser ;)
open page:
loginresponse = jsoup.connect("http://www.pastebin.com/login.php") .method(connection.method.get) .execute();
login
loginresponse = jsoup.connect("http://www.pastebin.com/login.php") .data("submit_hidden", "submit_hidden") .data("user_name", name) .data("user_password", pwrd) .data("submit", "login") .cookies(loginresponse.cookies()) // pass cookies .method(method.post) .execute();
end
Comments
Post a Comment