Created
October 23, 2015 23:18
-
-
Save jaxbot/78d90a4b6db89e438c5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String getHTTPString(String url, CookieStore jar) { | |
try { | |
DefaultHttpClient httpclient = new DefaultHttpClient(); | |
HttpGet httpget = new HttpGet(url); | |
httpget.setHeader("User-Agent", UA); | |
httpclient.setCookieStore(jar); | |
HttpResponse response = httpclient.execute(httpget); | |
InputStream inputStream = response.getEntity().getContent(); | |
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); | |
String line; | |
String result = ""; | |
while ((line = bufferedReader.readLine()) != null) { | |
result += line; | |
} | |
inputStream.close(); | |
return result; | |
} catch (Exception e) { | |
System.out.println(e); | |
} | |
return ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment