title: How to post form login using jsoup?
body: <p>i want to login in <a href="https://www.desco.org.bd/ebill/login.php" rel="noreferrer">here</a>
  <img src="https://i.stack.imgur.com/oj84K.png" alt="enter image description here">
  source code </p>
  
  <pre><code>&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;:: Dhaka Electric Supply Company Limited (DESCO)::&lt;/TITLE&gt;
  &lt;META http-equiv=Content-Type content="text/html; charset=utf-8"&gt;
  &lt;META http-equiv=Pragma content=no-cache&gt;
  &lt;META http-equiv=imagetoolbar content=no&gt;
  &lt;META content="Home Page of  Dhaka Electric Supply Company Limited" name=description&gt;
  &lt;META content="MSHTML 6.00.2900.2180" name=GENERATOR&gt;
  &lt;style type="text/css"&gt;
      img{
          border:0px;
      }   
  &lt;/style&gt;
  &lt;script type="text/javascript" src="js/ajax-dynamic-content.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/ajax.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/ajax-tooltip.js"&gt;&lt;/script&gt;   
  &lt;link rel="stylesheet" href="css/ajax-tooltip.css" media="screen" type="text/css"&gt;
  &lt;link rel="stylesheet" href="css/ajax-tooltip-demo.css" media="screen" type="text/css"&gt;
  &lt;LINK media=all href="css/global.css" type=text/css rel=stylesheet&gt;
  
  
  &lt;/HEAD&gt; 
  &lt;BODY&gt;
  &lt;DIV id=over style="DISPLAY: none"&gt;&lt;/DIV&gt;
  &lt;DIV class=baselayout&gt;
  &lt;DIV class=pagetopshadow&gt;&lt;/DIV&gt;
  &lt;DIV class=basebg&gt;
  &lt;DIV class=pageleft&gt;&lt;/DIV&gt;
  &lt;DIV class=pagecenter&gt;
  &lt;DIV id=Header&gt;
  &lt;/DIV&gt;
  &lt;DIV id=Menu&gt;
  &lt;/DIV&gt;
  &lt;DIV id=HomeContent&gt;
  &lt;DIV class=right&gt;
  &lt;DIV class=homeintro&gt;
  
  &lt;div style="padding-top: 0px;"&gt;
  &lt;script&gt; 
  function checkLogin()
   { if( document.login.username.value == '') 
    { 
    alert( 'Please enter  your account number' );
     return false; 
     }return true;
     }
     alert('Payments through VISA and Master Card are stopped by DBBL. only DBBL Nexus card is allowed.');
      &lt;/script&gt;
  
          &lt;form NAME='login' METHOD='POST' ACTION='authentication.php'&gt;
  
            &lt;table width="350" height="181"cellpadding='0' cellspacing='0' border='0' style="border:#e5e5e5 0px solid; BACKGROUND: url(css/images/top9.png) no-repeat left top;" align="center"&gt;
            &lt;tr&gt; &lt;td rowspan="6" style="padding-left:15px;"&gt;&lt;img src="css/images/groupperms.gif" width="50" height="50"&gt;&lt;td&gt;&lt;/tr&gt;
              &lt;tr&gt;
                &lt;td colspan="2" height="50"&gt;&lt;/td&gt;
              &lt;/tr&gt;
             &lt;tr&gt;
                &lt;td nowrap&gt;&lt;span class="textcolor1"&gt;Account No. &lt;/span&gt;&lt;/td&gt;
                &lt;td&gt;&lt;input type='text' name='username' style="border:#cacaca 2px solid; color:#000099;" value=''&gt;&lt;/td&gt;&lt;/tr&gt;
  
              &lt;tr&gt;
              &lt;td&gt; &lt;a class="uiTooltip" href="#" onMouseOver="ajax_showTooltip(window.event,'tooltip/help.html',this);return false" onMouseOut="ajax_hideTooltip()"&gt;Help&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input name="login" type='submit' value='Login' style="width:80px; font-family:Arial, Helvetica, sans-serif; font-weight:bold; color:#FFFFFF; border:#000000 2px solid; cursor:pointer; background-color: #1b4585;"  border="0" align="right" title="Login"  onClick="return checkLogin();"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
          &lt;/table&gt;
  
          &lt;/form&gt;
  &lt;table width="630" border="0" cellspacing="2" cellpadding="2" align="center" bgcolor="#FFFFFF" bordercolor="#FFFFFF"&gt;
    &lt;tr&gt;
      &lt;td width="80"&gt;&lt;/td&gt;
      &lt;td&gt;&lt;img src="images/right_3.gif"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span class="textcolor"&gt;&lt;strong&gt;&lt;a href='https://www.desco.org.bd/index.php?page=internet-bill-payment' target="_blank" class="uiTooltip"&gt;Before, use this facility/services please read instructions...&lt;/a&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
  &lt;p align="center" class="textcolor"&gt;&lt;strong&gt;&lt;a href='https://www.desco.org.bd' class="uiTooltip"&gt;Back Home&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
  &lt;table align="center" width="135" border="0" cellpadding="2" cellspacing="0" title="Click to Verify - This site chose VeriSign SSL for secure e-commerce and confidential communications."&gt;
  &lt;tr&gt;
  &lt;td width="135" align="center" valign="top"&gt;&lt;script type="text/javascript" src="https://seal.verisign.com/getseal?host_name=www.desco.org.bd&amp;amp;size=S&amp;amp;use_flash=YES&amp;amp;use_transparent=YES&amp;amp;lang=en"&gt;&lt;/script&gt;&lt;br /&gt;
  &lt;a href="http://www.verisign.com/ssl-certificate/" target="_blank"  style="color:#000000; text-decoration:none; font:bold 7px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;"&gt;ABOUT SSL CERTIFICATES&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  
  
  &lt;/div&gt;
  &lt;div align="center" style="padding-top:10px;"&gt;
  
  
  
  &lt;CENTER&gt;&lt;B&gt;
      Total Visits:  1&lt;/B&gt;&lt;/CENTER&gt;   
  &lt;/div&gt;
  &lt;/DIV&gt;
  &lt;/DIV&gt;
  &lt;/DIV&gt;
  &lt;/DIV&gt;
  &lt;DIV class=pageright&gt;&lt;/DIV&gt;&lt;/DIV&gt;
  &lt;DIV class=pagebotshadow&gt;
  &lt;DIV  id=Footer&gt;Copyright © 2010 Dhaka Electric Supply Company Ltd. All rights reserved.&lt;/DIV&gt;
  &lt;/DIV&gt;
  &lt;/DIV&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>basically below code is the form</p>
  
  <pre><code>&lt;form NAME='login' METHOD='POST' ACTION='authentication.php'&gt;
  
        &lt;table width="350" height="181"cellpadding='0' cellspacing='0' border='0' style="border:#e5e5e5 0px solid; BACKGROUND: url(css/images/top9.png) no-repeat left top;" align="center"&gt;
        &lt;tr&gt; &lt;td rowspan="6" style="padding-left:15px;"&gt;&lt;img src="css/images/groupperms.gif" width="50" height="50"&gt;&lt;td&gt;&lt;/tr&gt;
          &lt;tr&gt;
            &lt;td colspan="2" height="50"&gt;&lt;/td&gt;
          &lt;/tr&gt;
         &lt;tr&gt;
            &lt;td nowrap&gt;&lt;span class="textcolor1"&gt;Account No. &lt;/span&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type='text' name='username' style="border:#cacaca 2px solid; color:#000099;" value=''&gt;&lt;/td&gt;&lt;/tr&gt;
  
          &lt;tr&gt;
          &lt;td&gt; &lt;a class="uiTooltip" href="#" onMouseOver="ajax_showTooltip(window.event,'tooltip/help.html',this);return false" onMouseOut="ajax_hideTooltip()"&gt;Help&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input name="login" type='submit' value='Login' style="width:80px; font-family:Arial, Helvetica, sans-serif; font-weight:bold; color:#FFFFFF; border:#000000 2px solid; cursor:pointer; background-color: #1b4585;"  border="0" align="right" title="Login"  onClick="return checkLogin();"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
      &lt;/table&gt;
  
      &lt;/form&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/HR6Q9.png" alt="enter image description here"></p>
  
  <p>i am trying this</p>
  
  <pre><code>package jsouptest;
  
  import org.jsoup.Connection;
  import org.jsoup.Jsoup;
  import org.jsoup.nodes.Document;
  
  public class JsouptTest {
      public static void main(String[] args) throws Exception {
  
          Connection.Response loginForm = Jsoup.connect("https://www.desco.org.bd/ebill/login.php")
                  .method(Connection.Method.GET)
                  .execute();
  
          Document document = Jsoup.connect("https://www.desco.org.bd/ebill/login.php")
                  .data("cookieexists", "false")
                  .data("username", "32007702")
                  .data("login", "Login")
                  .cookies(loginForm.cookies())
                  .post();
          System.out.println(document);
  
      }
  
  }
  </code></pre>
  
  <p>but im getting below error</p>
  
  <pre><code>Exception in thread "main" java.net.SocketTimeoutException: Read timed out
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:152)
      at java.net.SocketInputStream.read(SocketInputStream.java:122)
      at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
      at sun.security.ssl.InputRecord.read(InputRecord.java:480)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
      at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
      at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:439)
      at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:424)
      at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:178)
      at jsouptest.JsouptTest.main(JsouptTest.java:12)
  </code></pre>
  
  <p>am is missing something? how to fix it?</p>