Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.net.*;
- import java.util.*;
- public class whore
- {
- static HashMap<String, String> map2 = new HashMap<String, String>();
- public static void start(String[] urls, String cookies) throws Exception
- {
- ////////////////////
- // HEADER CONTENT //
- map2.put("(Request-Line", "POST /t*themanummer*,*beitragsnummer*.html HTTP/1.1");
- map2.put("Host", "forum.geizhals.at");
- // Was gehört hier her?
- map2.put("User-Agent", "");
- map2.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
- map2.put("Accept-Language", "en-US,en;q=0.5");
- map2.put("Accept-Encoding", "gzip, deflate");
- map2.put("DNT", "1");
- // Wird abgefragt, kein Problem.
- map2.put("Cookie", cookies);
- // Was gehört hier her?
- map2.put("Connection", "keep.alive");
- map2.put("Content-Type", "application/x-www-form-urlencoded");
- // Ich habe keine Ahnung wie diese Zahl entsteht!
- map2.put("Content-Length", "???");
- //////////////////
- // POST Content //
- map2.put("plonk", "true");
- // Bei einem Plonk Befelhl werden auch immer die Werte x und y mitgeschickt.
- // Was bedeuten sie?
- // Sind sie wichtig?
- map2.put("x", "???");
- map2.put("y", "???");
- letsgo(urls);
- System.out.println("fertig");
- }
- public static void letsgo(String[] urls) throws Exception
- {
- int fivepercent = ( urls.length/20 );
- int done = 0;
- for(int i = 0 ; i < urls.length; i++)
- {
- doSubmit(urls[i], map2);
- if(i%fivepercent == 0)
- {
- System.out.println(done + " Prozent abgeschlossen.");
- done += 5;
- }
- }
- }
- public static void doSubmit(String url, Map<String, String> data) throws Exception
- {
- URL siteUrl = new URL(url);
- HttpURLConnection conn = (HttpURLConnection) siteUrl.openConnection();
- conn.setRequestMethod("POST");
- conn.setDoOutput(true);
- conn.setDoInput(true);
- DataOutputStream out = new DataOutputStream(conn.getOutputStream());
- Set keys = data.keySet();
- Iterator keyIter = keys.iterator();
- String content = "";
- for(int i=0; keyIter.hasNext(); i++) {
- Object key = keyIter.next();
- if(i!=0) {
- content += "&";
- }
- content += key + "=" + URLEncoder.encode(data.get(key), "UTF-8");
- }
- //System.out.println(content);
- out.writeBytes(content);
- out.flush();
- out.close();
- BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
- //String line = "";
- //while((line=in.readLine())!=null)
- {
- //System.out.println(line);
- }
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment