public static String sendRequestPost(String URL) throws UnsupportedEncodingException { HttpClient client = new DefaultHttpClient(); HttpPost request = new HttpPost(URL); request.setEntity(new UrlEncodedFormEntity(pairs)); HttpResponse response; String responseStr; try { response = client.execute(request); responseStr = HttpHelper.request(response); return responseStr; } catch (Exception e) { Log.i(Constants.TAG, "não foi possivel mandar post"); } return null; }
public static String sendRequestGet(String URL) throws UnsupportedEncodingException { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(URL); HttpResponse response; String responseStr; try { response = client.execute(request); responseStr = HttpHelper.request(response); return responseStr; } catch (Exception e) { Log.i(Constants.TAG, "não foi possivel mandar get"); Log.e(Constants.TAG, e.getMessage(), e); } return null; }