Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String SIGNATURE = "signature"; //(This data is huge)
- String url = "someUrl";
- URL obj = new URL(url);
- HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
- //add reuqest header
- con.setRequestMethod("POST");
- con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
- con.setRequestProperty("PS-Sign",SIGNATURE);
- // Send post request
- con.setDoOutput(true);
- DataOutputStream wr = new DataOutputStream(con.getOutputStream());
- wr.flush();
- wr.close();
- int responseCode = con.getResponseCode();
- BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
- String inputLine;
- StringBuffer response = new StringBuffer();
- while ((inputLine = in.readLine()) != null) {
- response.append(inputLine);
- }
- in.close();
- //print result
- System.out.println(response.toString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement