@Override protected String doInBackground(String... urls) { Document doc = null; try { Connection.Response res = Jsoup.connect(urls[0]) .data("eid", mUserName) .timeout(3000) .data("pw", mPassword) .data("submit", "Login") .method(Method.POST) .execute(); doc = res.parse(); // get the cookie mCookieValue = res.cookie(COOKIE_TYPE); mLoginResponse = doc.toString(); /* Log.w("response", doc.toString());*/ } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return mLoginResponse; }
@Override public void generateSessionId() { LOGGER.info("login to DMM"); try { Connection.Response res = Jsoup.connect("https://www.dmm.co.jp/my/") .data("login_id", userId) .data("password", password) .data("sava_password", "1") .data("save_login_id", "1") .data("act", "commit") .method(Method.POST) .execute(); String sesId = res.cookie(SESSION_ID_KEY); LOGGER.info("sessionId={}", sesId); this.sessionId = sesId; } catch (SocketTimeoutException e) { LOGGER.warn("login failed", e); generateSessionIdRetry(3000); } catch (SSLHandshakeException e) { LOGGER.warn("login failed", e); generateSessionIdRetry(3000); } catch (IOException e) { throw new EgetException("failed to login", e); } }