HttpClient的使用1

public static String getUrlResponse(String url) {
        try {
            HttpGet get = new HttpGet(url);
            HttpClient client = new DefaultHttpClient();
            HttpResponse response = client.execute(get);
            HttpEntity entity = response.getEntity();
            return convertStreamToString(entity.getContent());
        } catch (Exception e) {
            return null;        
          }
        return null;
    }

 

你可能感兴趣的:(httpclient)