Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h3>Updated Answer:</h3> <p>Since some of the classes, in the original answer, are deprecated in the newer version of Apache HTTP Components, I'm posting this update.</p> <p>By the way, you can access the full documentation for more examples <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d5e37" rel="noreferrer">here</a>.</p> <pre><code>HttpClient httpclient = HttpClients.createDefault(); HttpPost httppost = new HttpPost("http://www.a-domain.com/foo/"); // Request parameters and other properties. List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(2); params.add(new BasicNameValuePair("param-1", "12345")); params.add(new BasicNameValuePair("param-2", "Hello!")); httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); //Execute and get the response. HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); try { // do something useful } finally { instream.close(); } } </code></pre> <h3>Original Answer:</h3> <p>I recommend to use Apache HttpClient. its faster and easier to implement.</p> <pre><code>PostMethod post = new PostMethod("http://jakarata.apache.org/"); NameValuePair[] data = { new NameValuePair("user", "joe"), new NameValuePair("password", "bloggs") }; post.setRequestBody(data); // execute method and handle any error responses. ... InputStream in = post.getResponseBodyAsStream(); // handle response. </code></pre> <p>for more information check this url: <a href="http://hc.apache.org/" rel="noreferrer">http://hc.apache.org/</a></p>
    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.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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