码迷,mamicode.com
首页 > Web开发 > 详细

http, post请求,发送json,并接收数据

时间:2018-03-23 11:42:18      阅读:321      评论:0      收藏:0      [点我收藏+]

标签:cep   输入   get   接收   result   exec   body   cut   数据   

  String url="www.baidu.com";

  HttpClient http = new HttpClient();        //创建http连接, 相当于,打开浏览器

  try {

    GetMethod get = new GetMethod(url)    //get      相当于,在浏览器的地址栏,输入地址

    if(http.executeMethod(get)==200){      //响应正常

      String result = get.getResponseBodyAsString()      //

    }

  }catch(Exception e){

  }finally{

  }

  

http, post请求,发送json,并接收数据

标签:cep   输入   get   接收   result   exec   body   cut   数据   

原文地址:https://www.cnblogs.com/liuqu/p/8628884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!