Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
public static void sent() throws MalformedURLException, ProtocolException, IOException {
        URL url = new URL("https://mobilerndhub.sec.samsung.net/gba/ticket/csccheckerwaiversuggetion.json");
        HttpURLConnection conn = (HttpURLConnection)url.openConnection();
        conn.setDoInput(true);
        conn.setDoOutput(true);
        conn.setRequestMethod("POST");
        conn.setUseCaches(false);
        conn.setRequestProperty("Content-Type", "application/json");
        conn.setRequestProperty("Accept", "application/json");
        conn.connect();
        
        OutputStream os = conn.getOutputStream();
        OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8");
        osw.write(json);
        osw.flush();
        osw.close();

        BufferedReader br = new BufferedReader(new InputStreamReader(
            conn.getInputStream(), "utf-8"));
        String line = br.readLine();
        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }
        br.close();

        System.out.println("Request sent!" + json);
    };