public class HttpUtil {
public static String Http(String path) {
try {
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(path);
HttpResponse response = client.execute(get);
int code = response.getStatusLine().getStatusCode();
if (code == 200) {
HttpEntity entity = response.getEntity();
String json = EntityUtils.toString(entity);
return json;
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
网络请求
猜你喜欢
转载自shilichao.iteye.com/blog/2318755
今日推荐
周排行