Linked Questions

Popular Questions

How I get the html all source?

Asked by At

I mean that I use below code to get html source from url. But it does not contain all source.Buffersize is problem or string size problem?

HttpURLConnection connection; 
            OutputStreamWriter request = null; 

                 URL url = null;    
                 String response = null;          
                 String parameters = "aranan="+et.getText();    

                     url = new URL(""); 
                     connection = (HttpURLConnection) url.openConnection(); 
                     connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); 

                     request = new OutputStreamWriter(connection.getOutputStream()); 
                     String line = "";                
                     InputStreamReader isr = new InputStreamReader(connection.getInputStream()); 
                     BufferedReader reader = new BufferedReader(isr); 
                     StringBuilder sb = new StringBuilder(); 
                     while ((line = reader.readLine()) != null) 
                         sb.append(line + "\n"); 
                     // Response from server after login process will be stored in response variable.                 
                     response = sb.toString(); 
                     // You can perform UI operations here 
                     browser.loadDataWithBaseURL(null, response,"text/html", "UTF-8", null); 


                 catch(IOException e) 
                     // Error 


I try some things like BufferedReader reader = new BufferedReader(isr,8192); But it does not work.

Related Questions