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
相關文章
相關標籤/搜索