首页 > 代码库 > 订单推送代码

订单推送代码

  //请求URL
  String url = "http://union.fanli.com/dingdan/push?shopid=1941";
  //获取请求POST PostMethod post
= new PostMethod(url);
//推送的内容 post.setParameter(
"content", sw.toString());
  //设置请求头 post.setRequestHeader(
"Content-type","application/x-www-form-urlencoded;charset=utf-8");
  //获取httpClient HttpClient httpClient
= new HttpClient();
//设置请求超时时间 httpClient.setTimeout(
10000);
  //发送请求
httpClient.executeMethod(post);
//获取请求返回结果 String body
= post.getResponseBodyAsString();
  //判断结果处理

 

 

 

订单推送代码