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 ;)

  1. open page:

    loginresponse = jsoup.connect("http://www.pastebin.com/login.php")         .method(connection.method.get)         .execute(); 
  2. 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(); 
  3. end


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -