httpUtil

public class httpUtil {
    public static String getJsonStr(String url) throws ClientProtocolException, IOException{
        HttpClient hc=new DefaultHttpClient();
        HttpPost post=new HttpPost(url);
        
        HttpResponse res=hc.execute(post);
        if(res.getStatusLine().getStatusCode()==200){
            String str=EntityUtils.toString(res.getEntity(),"utf-8");
            return str;
        }
        return null;
    }

}
Http

 

posted @ 2016-07-05 15:26  我问你瞅啥?  阅读(138)  评论(0)    收藏  举报