Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String executeHttpGet(String requestURL) throws URISyntaxException, ClientProtocolException, IOException {
- BufferedReader in = null;
- String result = "";
- try {
- HttpClient client = new DefaultHttpClient();
- HttpGet request = new HttpGet();
- request.setURI(new URI(requestURL));
- Log.i("requesting", requestURL);
- HttpResponse response = client.execute(request);
- in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
- StringBuffer sb = new StringBuffer("");
- String line = "";
- String NL = System.getProperty("line.separator");
- while ((line = in.readLine()) != null) {
- sb.append(line + NL);
- }
- in.close();
- result = sb.toString();
- } finally {
- try
- {
- in.close();
- }
- catch(NullPointerException e)
- {
- //
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement