Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7782157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:27:11+00:00 2026-06-01T19:27:11+00:00

I mean that I use below code to get html source from url. But

  • 0

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();    

                 try 
                 { 
                     url = new URL("http://www.fragmanfan.com/arama.asp"); 
                     connection = (HttpURLConnection) url.openConnection(); 
                     connection.setDoOutput(true); 
                     connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); 

                     request = new OutputStreamWriter(connection.getOutputStream()); 
                     request.write(parameters); 
                     request.flush();             
                     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); 

                     isr.close(); 
                     reader.close(); 

                 } 
                 catch(IOException e) 
                 { 
                     // Error 
                 } 




        } 
    }); 

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:27:12+00:00Added an answer on June 1, 2026 at 7:27 pm

    create a WebRequest class.
    Than make your request and get response.
    I tried that website, it works.

    WebRequest response = new WebRequest("http://www.fragmanfan.com/arama.asp?aranan=kurtlar", PostType.GET);
    String htmltext = response.Get();
    browser.loadDataWithBaseURL(null, htmltext, "text/html", "UTF-8", null);
    

    WebRequest.class

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.UnknownHostException;
    import java.nio.charset.Charset;
    import org.apache.http.HttpResponse;
    import org.apache.http.client.CookieStore;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.methods.HttpGet;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.client.protocol.ClientContext;
    import org.apache.http.impl.client.BasicCookieStore;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.protocol.BasicHttpContext;
    import org.apache.http.protocol.HttpContext;
    
    public class WebRequest {
      public enum PostType{
        GET, POST;
      }
    
      public String _url;
      public String response = "";
      public PostType _postType;
      CookieStore _cookieStore = new BasicCookieStore();
    
      public WebRequest(String url) {
        _url = url;
        _postType = PostType.POST;
      }
    
      public WebRequest(String url, CookieStore cookieStore) {
        _url = url;
        _cookieStore = cookieStore;
        _postType = PostType.POST;
      }
    
      public WebRequest(String url, PostType postType) {
        _url = url;
        _postType = postType;
      }
    
      public String Get() {
        HttpClient httpclient = new DefaultHttpClient();
    
        try {
          // Create local HTTP context
          HttpContext localContext = new BasicHttpContext();
    
          // Bind custom cookie store to the local context
          localContext.setAttribute(ClientContext.COOKIE_STORE, _cookieStore);
    
          HttpResponse httpresponse;
          if (_postType == PostType.POST)
          {
            HttpPost httppost = new HttpPost(_url);
            httpresponse = httpclient.execute(httppost, localContext);
          }
          else
          {
            HttpGet httpget = new HttpGet(_url);
            httpresponse = httpclient.execute(httpget, localContext);
          }
    
          StringBuilder responseString = inputStreamToString(httpresponse.getEntity().getContent());
    
          response = responseString.toString();
        }
        catch (UnknownHostException e) {
          e.printStackTrace();
        }
        catch (Exception e) {
          e.printStackTrace();
        }
        finally {
          // When HttpClient instance is no longer needed,
          // shut down the connection manager to ensure
          // immediate deallocation of all system resources
          httpclient.getConnectionManager().shutdown();
        }
    
        return response;
      }
    
      private StringBuilder inputStreamToString(InputStream is) throws IOException {
        String line = "";
        StringBuilder total = new StringBuilder();
    
        // Wrap a BufferedReader around the InputStream
        BufferedReader rd = new BufferedReader(new InputStreamReader(is,Charset.forName("iso-8859-9")));
        // Read response until the end
        while ((line = rd.readLine()) != null) {
          total.append(line);
        }
    
        // Return full string
        return total;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how would you use JQuery with asp.net Code-Behind what i mean by that: i
I only have experience with log4net however that does not mean that there are
Does that mean that I can't share a Form between delphi 2007 and 2009?
What exactly does immutable mean - that is, what are the consequences of an
What does it mean that a Transaction Log is Full? I have it the
xmpp is federated. does that mean that as long as i connected to one
I'm having trouble with preg_replace and I'm not sure that I use correct function.
I wrote code that fails to use the JQuery autocomplete to fire a result
Below is the link to the code that has the two RAdEditors I am
I have a code that needs to go to the website below and extract

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.