Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I always do this in two steps (like normal human),</p> <ol> <li>Read login page (by GET, read cookies)</li> <li>Submit form and cookies (by POST, without cookie manipulation)</li> </ol> <p>Example:</p> <pre><code>Connection.Response response = Jsoup.connect("http://www.mikeportnoy.com/forum/login.aspx") .method(Connection.Method.GET) .execute(); response = Jsoup.connect("http://www.mikeportnoy.com/forum/login.aspx") .data("ctl00$ContentPlaceHolder1$ctl00$Login1$UserName", "username") .data("ctl00$ContentPlaceHolder1$ctl00$Login1$Password", "password") .cookies(response.cookies()) .method(Connection.Method.POST) .execute(); Document homePage = Jsoup.connect("http://www.mikeportnoy.com/forum/default.aspx") .cookies(response.cookies()) .get(); </code></pre> <p>And always set cookies from previuos request to next using</p> <pre><code> .cookies(response.cookies()) </code></pre> <p>SSL is not important here. If you have problem with certifcates then execute this method for ignore SSL.</p> <pre><code>public static void trustEveryone() { try { HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, new X509TrustManager[]{new X509TrustManager() { public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } }}, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory()); } catch (Exception e) { // should never happen e.printStackTrace(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload