/* package whatever; // don't place package name! */

package threadupdate;
import java.io.*;
import java.util.*;
import java.io.IOException; 
import org.apache.http.client.*;
import org.apache.http.client.methods.*;
import java.util.List;
import org.apache.http.client.entity.*;
import org.apache.http.impl.client.*;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.HttpResponse;
import org.apache.http.HttpEntity;
import org.apache.http.util.EntityUtils;

class Search {
    
    public static void main(String[] args) throws Exception {
        
    
    HttpClient httpclient = HttpClients.createDefault();
    HttpPost httppost = new HttpPost("boards.4chan.org/int/catalog#s=");

    // Request parameters and other properties.
    List<NameValuePair> params = new ArrayList<NameValuePair>(1);
    params.add(new BasicNameValuePair("qf-box", "balt"));
    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 {
            String content =  EntityUtils.toString(entity);
            System.out.print(content);
        } 
        catch (ClientProtocolException e) {
        // writing exception to log
            e.printStackTrace();
        } catch (IOException e) {
        // writing exception to log
            e.printStackTrace();
        }  
        finally {
            instream.close();
        }
    }
           
    
    }
}