Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String GET()
- {
- String link = "http://site.com/sample.json";
- HttpURLConnection urlConnection = null;
- InputStream inStream = null;
- URL url = new URL(link);
- urlConnection = (HttpURLConnection) url.openConnection();
- urlConnection.setRequestMethod("GET");
- urlConnection.setDoOutput(true);
- urlConnection.setDoInput(true);
- urlConnection.connect();
- inStream = urlConnection.getInputStream();
- BufferedReader bReader = new BufferedReader(new InputStreamReader(inStream));
- String temp, response = "";
- while ((temp = bReader.readLine()) != null) {
- response += temp;
- }
- return response;
- }
Advertisement
Add Comment
Please, Sign In to add comment