Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The easiest way to answer my question is to show you the class that I made :</p> <pre> public class HTTPHelp{ DefaultHttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); private boolean abort; private String ret; HttpResponse response = null; HttpPost httpPost = null; public HTTPHelp(){ } public void clearCookies() { httpClient.getCookieStore().clear(); } public void abort() { try { if(httpClient!=null){ System.out.println("Abort."); httpPost.abort(); abort = true; } } catch (Exception e) { System.out.println("HTTPHelp : Abort Exception : "+e); } } public String postPage(String url, String data, boolean returnAddr) { ret = null; httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); httpPost = new HttpPost(url); response = null; StringEntity tmp = null; httpPost.setHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux " + "i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)"); httpPost.setHeader("Accept", "text/html,application/xml," + "application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); try { tmp = new StringEntity(data,"UTF-8"); } catch (UnsupportedEncodingException e) { System.out.println("HTTPHelp : UnsupportedEncodingException : "+e); } httpPost.setEntity(tmp); try { response = httpClient.execute(httpPost,localContext); } catch (ClientProtocolException e) { System.out.println("HTTPHelp : ClientProtocolException : "+e); } catch (IOException e) { System.out.println("HTTPHelp : IOException : "+e); } ret = response.getStatusLine().toString(); return ret; } } </pre> <p>I used <a href="https://hc.apache.org/httpcomponents-client-ga/tutorial/html/" rel="nofollow noreferrer">this tutorial</a> to do my post method and <a href="https://hc.apache.org/httpcomponents-client-ga/examples.html" rel="nofollow noreferrer">thoses examples</a> (Thanks Daniel).</p> <p>Thank your for your help.</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. 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.
    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