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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -