最简单的一个http连接


HttpClient client = new HttpClient();
String url = "http://www.baidu.com";
HttpMethod method = new GetMethod(url);
int statusCode = client.executeMethod(method);
byte[] responseBody = method.getResponseBody();
String content = method.getResponseBodyAsString();
method.releaseConnection();

你可能感兴趣的:(最简单的一个http连接)