 HttpGet httpRequest = new HttpGet( "http://example.com"); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httpRequest); int code = response.getStatusLine().getStatusCode();  