title: Android - HTTP Get request on LAN
body: <p>I am using the following code to get a page's source which is a plain text (no html tags) from a webserver on LAN. But I am always getting empty string in return and If I open the same URI in browser I can see the text. Following is my code:</p>
  
  <pre><code>                String url = "http://192.168.1.40/touchscreens/get.qsp?display=1";
  
                  HttpClient client = new DefaultHttpClient();
  
                  HttpGet request = new HttpGet();
                  request.setHeader("Content-Type", "text/plain; charset=utf-8");
  
                  request.setURI(new URI(url));
                  HttpResponse response = client.execute(request);
  
                  in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
  
                  StringBuffer sb = new StringBuffer("");
                  String line = "";
                  String NL = System.getProperty("line.separator");
  
                  while ((line = in.readLine()) != null) {
                      sb.append(line + NL);
                  }
  
                  String page = sb.toString();
  
                  Toast.makeText(getApplicationContext(), page, Toast.LENGTH_LONG).show();
  </code></pre>
  
  <p>and one more thing when I enter the same URL in android emulator browser I don't see anything. Am i missing something?</p>