Android.Http

来源:互联网 发布:ubuntu 显示文件列表 编辑:程序博客网 时间:2024/06/05 22:33

public static String getResultForHttpGet(String url) throws ClientProtocolException, IOException

{      

       String result="";  
              
       HttpGet httpGet=new HttpGet(url);//与HttpPost区别所在,这里是将参数在地址中传递  
       HttpResponse response=new DefaultHttpClient().execute(httpGet);  
       if(response.getStatusLine().getStatusCode()==200){  
                HttpEntity entity=response.getEntity();  
                result=EntityUtils.toString(entity, HTTP.UTF_8);  
       }  

       return result; 

}


0 0
原创粉丝点击