Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- HttpPost post = new HttpPost("http://www.derpforum.nl/?p=login");
- List<NameValuePair> parameters = new ArrayList<>();
- parameters.add(new BasicNameValuePair("username", "Kattoor4"));
- parameters.add(new BasicNameValuePair("password", "deburen1995"));
- parameters.add(new BasicNameValuePair("ip-check", "on"));
- UrlEncodedFormEntity sendentity = new UrlEncodedFormEntity(parameters, HTTP.UTF_8);
- post.setEntity(sendentity);
- CookieStore cookieStore = new BasicCookieStore();
- HttpContext httpContext = new BasicHttpContext();
- HttpClient client = new DefaultHttpClient();
- httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
- HttpResponse response = client.execute(post, httpContext);
- System.out.println(response.getStatusLine());
- EntityUtils.consume(response.getEntity());
- HttpGet get = new HttpGet("http://www.derpforum.nl");
- response = client.execute(get, httpContext);
- BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
- String line;
- while ((line = reader.readLine()) != null)
- System.out.println(line);
- } catch (Exception e) {
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment