fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. package threadupdate;
  4. import java.io.*;
  5. import java.util.*;
  6. import java.io.IOException;
  7. import org.apache.http.client.*;
  8. import org.apache.http.client.methods.*;
  9. import java.util.List;
  10. import org.apache.http.client.entity.*;
  11. import org.apache.http.impl.client.*;
  12. import org.apache.http.NameValuePair;
  13. import org.apache.http.message.BasicNameValuePair;
  14. import org.apache.http.HttpResponse;
  15. import org.apache.http.HttpEntity;
  16. import org.apache.http.util.EntityUtils;
  17.  
  18. class Search {
  19.  
  20. public static void main(String[] args) throws Exception {
  21.  
  22.  
  23. HttpClient httpclient = HttpClients.createDefault();
  24. HttpPost httppost = new HttpPost("boards.4chan.org/int/catalog#s=");
  25.  
  26. // Request parameters and other properties.
  27. List<NameValuePair> params = new ArrayList<NameValuePair>(1);
  28. params.add(new BasicNameValuePair("qf-box", "balt"));
  29. httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
  30.  
  31. //Execute and get the response.
  32. HttpResponse response = httpclient.execute(httppost);
  33. HttpEntity entity = response.getEntity();
  34.  
  35. if (entity != null) {
  36. InputStream instream = entity.getContent();
  37. try {
  38. String content = EntityUtils.toString(entity);
  39. System.out.print(content);
  40. }
  41. catch (ClientProtocolException e) {
  42. // writing exception to log
  43. e.printStackTrace();
  44. } catch (IOException e) {
  45. // writing exception to log
  46. e.printStackTrace();
  47. }
  48. finally {
  49. instream.close();
  50. }
  51. }
  52.  
  53.  
  54. }
  55. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:7: error: package org.apache.http.client does not exist
import org.apache.http.client.*;
^
Main.java:8: error: package org.apache.http.client.methods does not exist
import org.apache.http.client.methods.*;
^
Main.java:10: error: package org.apache.http.client.entity does not exist
import org.apache.http.client.entity.*;
^
Main.java:11: error: package org.apache.http.impl.client does not exist
import org.apache.http.impl.client.*;
^
Main.java:12: error: package org.apache.http does not exist
import org.apache.http.NameValuePair;
                      ^
Main.java:13: error: package org.apache.http.message does not exist
import org.apache.http.message.BasicNameValuePair;
                              ^
Main.java:14: error: package org.apache.http does not exist
import org.apache.http.HttpResponse;
                      ^
Main.java:15: error: package org.apache.http does not exist
import org.apache.http.HttpEntity;
                      ^
Main.java:16: error: package org.apache.http.util does not exist
import org.apache.http.util.EntityUtils;
                           ^
Main.java:23: error: cannot find symbol
    HttpClient httpclient = HttpClients.createDefault();
    ^
  symbol:   class HttpClient
  location: class Search
Main.java:23: error: cannot find symbol
    HttpClient httpclient = HttpClients.createDefault();
                            ^
  symbol:   variable HttpClients
  location: class Search
Main.java:24: error: cannot find symbol
    HttpPost httppost = new HttpPost("boards.4chan.org/int/catalog#s=");
    ^
  symbol:   class HttpPost
  location: class Search
Main.java:24: error: cannot find symbol
    HttpPost httppost = new HttpPost("boards.4chan.org/int/catalog#s=");
                            ^
  symbol:   class HttpPost
  location: class Search
Main.java:27: error: cannot find symbol
    List<NameValuePair> params = new ArrayList<NameValuePair>(1);
         ^
  symbol:   class NameValuePair
  location: class Search
Main.java:27: error: cannot find symbol
    List<NameValuePair> params = new ArrayList<NameValuePair>(1);
                                               ^
  symbol:   class NameValuePair
  location: class Search
Main.java:28: error: cannot find symbol
    params.add(new BasicNameValuePair("qf-box", "balt"));
                   ^
  symbol:   class BasicNameValuePair
  location: class Search
Main.java:29: error: cannot find symbol
    httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
                           ^
  symbol:   class UrlEncodedFormEntity
  location: class Search
Main.java:32: error: cannot find symbol
    HttpResponse response = httpclient.execute(httppost);
    ^
  symbol:   class HttpResponse
  location: class Search
Main.java:33: error: cannot find symbol
    HttpEntity entity = response.getEntity();
    ^
  symbol:   class HttpEntity
  location: class Search
Main.java:38: error: cannot find symbol
            String content =  EntityUtils.toString(entity);
                              ^
  symbol:   variable EntityUtils
  location: class Search
Main.java:41: error: cannot find symbol
        catch (ClientProtocolException e) {
               ^
  symbol:   class ClientProtocolException
  location: class Search
21 errors
stdout
Standard output is empty