public String read(String urlString){ try { StringBuffer html = new StringBuffer(); URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); InputStreamReader inputReader = new InputStreamReader(conn.getInputStream()); BufferedReader bufferedReader = new BufferedReader(inputReader); String temp; while ((temp = bufferedReader.readLine()) != null) { if(!temp.trim().equals("")){ html.append(temp).append("\n"); } } bufferedReader.close(); inputReader.close(); return html.toString(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }