Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.client;
- import java.io.BufferedReader;
- import java.io.DataOutputStream;
- import java.io.File;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.net.HttpURLConnection;
- import java.net.URL;
- //import net.minecraft.Util_OS;
- public class Util {
- private static File workDir = null;
- // $FF: synthetic field
- private static int[] $SWITCH_TABLE$net$minecraft$Util$OS;
- public Util() {
- super();
- }
- public static String excutePost(String targetURL, String urlParameters) {
- HttpURLConnection connection = null;
- boolean var13 = false;
- String var10;
- label84: {
- try {
- var13 = true;
- URL url = new URL(targetURL);
- connection = (HttpURLConnection)url.openConnection();
- connection.setRequestMethod("POST");
- connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
- connection.setRequestProperty("Content-Length", Integer.toString(urlParameters.getBytes().length));
- connection.setRequestProperty("Content-Language", "en-US");
- connection.setUseCaches(false);
- connection.setDoInput(true);
- connection.setDoOutput(true);
- DataOutputStream e = new DataOutputStream(connection.getOutputStream());
- e.writeBytes(urlParameters);
- e.flush();
- e.close();
- InputStream is = connection.getInputStream();
- BufferedReader rd = new BufferedReader(new InputStreamReader(is));
- StringBuffer response = new StringBuffer();
- String line;
- while((line = rd.readLine()) != null) {
- response.append(line);
- response.append('\r');
- }
- rd.close();
- var10 = response.toString();
- var13 = false;
- break label84;
- } catch (Exception var14) {
- var14.printStackTrace();
- var13 = false;
- } finally {
- if(var13) {
- if(connection != null) {
- connection.disconnect();
- }
- }
- }
- if(connection != null) {
- connection.disconnect();
- }
- return null;
- }
- if(connection != null) {
- connection.disconnect();
- }
- return var10;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement