zoukankan      html  css  js  c++  java
  • httpclient

     @Test
        public void testQuery(){
            CloseableHttpClient client= HttpClients.createDefault();
            HttpGet post=new HttpGet("https://webchargewg.bestpay.com.cn/createEpayPwdKey?keyId=201512150857031450141067494");
            try {
                post.setHeader("User-Agent:","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0");
                HttpResponse response=client.execute(post);
                String cooke="";
                for(Header header:response.getHeaders("Set-Cookie")){
                    cooke=header.getValue();
                }
                HttpClient client1= HttpClients.createDefault();
                System.out.println(EntityUtils.toString(response.getEntity()));
                HttpPost httpPost=new HttpPost("https://webchargewg.bestpay.com.cn/accountCounter/checkTxnPwd");
                httpPost.setHeader("User-Agent:","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0");
                httpPost.setHeader("Accept:","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
                httpPost.setHeader("Accept-Language:","zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3");
                httpPost.setHeader("Connection:","keep-alive");
                httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
                httpPost.setHeader("Cookie",cooke);
                String params="accountKey=18684999436&accountKeyType=2&txnPassword=M1EJhYrr40n460FWZ%2FQ4YA%3D%3D&keyId=201512150857031450141067494&channel=01&merId=043101180050000";
                httpPost.setEntity(new StringEntity(params, Charset.forName("utf-8")));
                HttpResponse response1=client1.execute(httpPost);
                System.out.println(EntityUtils.toString(response1.getEntity()));

            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            } catch (ClientProtocolException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
  • 相关阅读:
    GPS时钟参考源(GPS同步时钟)电力系统探讨
    GPS对时系统(时间同步系统)建设才是电力基础
    NTP授时服务器(NTP时钟服务器)基本原理介绍
    NTP授时服务器(北斗授时产品)在广播电视系统里的应用
    GPS北斗授时设备共视对比及传输链路接口
    基于NTP时钟服务器的时间同步数据采集系统
    利用GPS或北斗卫星开发的一款NTP授时服务器
    GPS时钟系统(卫星时钟同步)才是智能变电站的基础建设
    PTP精密时钟服务器IEEE1588(V2.0)协议浅析
    电子时钟显示屏,时间同步显示,GPS时钟系统
  • 原文地址:https://www.cnblogs.com/dinglulu/p/5069816.html
Copyright © 2011-2022 走看看