Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String makeWebCall(String url) {
- System.out
- .println("@#$@#@$#$@#$@$##$-----FOR ACTIVITES ------->>>>>>>>>>>>> ---------->");
- HttpGet httpRequest = new HttpGet(url);
- try {
- HttpResponse httpResponse = client.execute(httpRequest);
- System.out.println("=========> Response from login123 => "+httpResponse);
- final int statusCode = httpResponse.getStatusLine().getStatusCode();
- System.out.println("=========> statusCode from the url => " + statusCode);
- if (statusCode != HttpStatus.SC_OK) {
- return null;
- }
- HttpEntity entity = httpResponse.getEntity();
- InputStream instream = entity.getContent();
- String streamValue = iStream_to_String(instream);
- if (entity != null) {
- // httpRequest.abort();
- instream.close();
- EntityUtils.consume(entity);
- }
- return streamValue;
- }
- catch (IOException e) {
- httpRequest.abort();
- // Log.w(getClass().getSimpleName(), "Error for URL =>" + url, e);
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement