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

Posted 流去

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了http, post请求,发送json,并接收数据相关的知识,希望对你有一定的参考价值。

  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,并接收数据的主要内容,如果未能解决你的问题,请参考以下文章