Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String sendData(String URL, String message) throws IOException {
- URL url = new URL(URL);
- URLConnection connection = url.openConnection();
- connection.setDoOutput(true);
- DataOutputStream printout = new DataOutputStream(
- connection.getOutputStream());
- printout.writeBytes(message);
- printout.flush();
- printout.close();
- BufferedReader in = new BufferedReader(new InputStreamReader(
- connection.getInputStream()));
- String returnData = "";
- String temp;
- while ((temp = in.readLine()) != null) {
- returnData += temp + "\n";
- }
- return returnData;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement