Well, if you just need content, why don't you simplify it this way:
private InputStream OpenHttpConnection(String strURL)
throws IOException {
URLConnection conn = null;
InputStream inputStream = null;
URL url = new URL(strURL);
conn = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) conn;
httpConn.setRequestMethod("GET");
httpConn.connect();
if (httpConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
inputStream = httpConn.getInputStream();
}
return inputStream;
}
And then just read the stream?
source
share