Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static String defaultHTTPConnection(String url) {
- HttpClient httpclient = new DefaultHttpClient();
- HttpGet request = new HttpGet();
- URI website;
- try {
- website = new URI(url);
- request.setURI(website);
- HttpResponse response = httpclient.execute(request);
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
- return bufferedReader.readLine();
- } catch (URISyntaxException e) {
- Log.e(TAG, "Can't create URI");
- } catch (ClientProtocolException e) {
- Log.e(TAG, "Something went wrong when connection to client");
- } catch (IOException e) {
- Log.e(TAG, "IOException");
- }
- throw new RuntimeException("Could not connect to server");
- }
Advertisement
Add Comment
Please, Sign In to add comment