@Override public JSONObject getFirstPage() throws IOException { Connection.Response resp = Http.url(url).response(); LOGGER.info(resp.cookies()); csrftoken = resp.cookie("csrftoken"); Document p = resp.parse(); // Get the query hash so we can download the next page qHash = getQHash(p); return getJSONFromPage(p); }
String MSPOK = authorize.cookie("MSPOK"); if (MSPOK == null) { IOException e = new IOException("Error while connecting to Live: MSPOK not set.");
private void attemptLogin() { try { ConnectionProvider connectionProvider = Inject.connectionProvider(); Connection.Response response = connectionProvider .loginConnection(username, password) .execute(); String cookie = response.cookie("user"); String cfduid = response.cookie("_cfduid"); if (!TextUtils.isEmpty(cookie)) { subscriber.onNext(new Login(username, cookie, Login.Status.SUCCESSFUL)); } else { subscriber.onNext(new Login(username, null, Login.Status.WRONG_CREDENTIALS)); } } catch (IOException e) { subscriber.onError(e); } } }
String sessionId = res.cookie("SESSIONID");
static Map<String,String> connect() throws IOException{ Connection.Response res = Jsoup.connect("https://www.facebook.com/login.php") .data("username", "dietime1943@hotmail.com", "password", "password") .timeout(30 * 1000) .userAgent("Mozilla/5.0") .method(Method.POST) .execute(); Document doc = res.parse(); System.out.println(doc); Map<String, String> loginCookies = res.cookies(); String sessionId = res.cookie("SESSIONID"); return loginCookies; } }
public String getCookieValue(String cookieName) { return getResponse().cookie(cookieName); }
protected String getSessionId(String hacURL) { final Response res = getResponseForUrl(hacURL); if (res == null) { return null; } return res.cookie("JSESSIONID"); }