Code example for DefaultHttpClient

Methods: execute

0
	} 
 
	public static InputStream getInputStreamFromUrl(String url)
			throws ClientProtocolException, IOException { 
		HttpGet request = new HttpGet(url);
		DefaultHttpClient client = new DefaultHttpClient(getTimeoutHttpParams());
		HttpResponse response = client.execute(request);
		int statusCode = response.getStatusLine().getStatusCode();
		if (statusCode != 200) {
			Log.e(TAG, "Failed to get stream for: " + url);
			throw new IOException("Failed to get stream for: " + url);
		} 
		return response.getEntity().getContent();
	} 
 
	public static String fetchContent(String url)
			throws ClientProtocolException, IOException { 
		InputStream input = getInputStreamFromUrl(url);
		try { 
			int c;
			byte[] buffer = new byte[8192];