Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1.             URL site = new URL("url");
  2.                 HttpURLConnection con = (HttpURLConnection)site.openConnection();
  3.                 con.setRequestMethod("POST");
  4.                 con.setDoOutput(true);
  5.            
  6.                 BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(con.getOutputStream()));
  7.    
  8.                 String args = "report=" + json.toString() + "&secret="+ md5(playermp.username + "zWdNvkp0xU6P11rE0KZXN0H07qMx3kVnz1xBv0pbxzxO");
  9.                 System.out.println(args);
  10.                 wr.write(args);
  11.                 wr.flush();
  12.                    
  13.                 Scanner httpResponseScanner = new Scanner(con.getInputStream()); //Создаем сканнер для получения ответ от веб-сервера
  14.                 String response = "";
  15.                 while(httpResponseScanner.hasNext())
  16.                 {
  17.                     response = response + httpResponseScanner.nextLine();
  18.                 }
  19.                 httpResponseScanner.close();
  20.                 System.out.println("Response: " + response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement