network request

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;
}

}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326616846&siteId=291194637