<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    少年阿賓

    那些青春的歲月

      BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
      500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

    package com.abin.lee.hack;

    import java.io.BufferedInputStream;

    import org.apache.http.HttpHost;
    import org.apache.http.HttpResponse;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.entity.StringEntity;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.junit.Test;

    public class HttpClientVisitTest {

     private static final String HttpUrl = " private static final String HttpHost = "111.111.111.111";
     @Test
     public void testHttpClientVisit() {
      HttpClient httpClient = new DefaultHttpClient();
      HttpPost httpPost = new HttpPost(HttpUrl);
      httpPost.addHeader("Accept", "*/*");
      httpPost.addHeader("Accept-Language", "zh-cn");
      httpPost.addHeader("Referer", HttpUrl);
      httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded");
      httpPost.addHeader("Cache-Control", "no-cache");
      httpPost.addHeader("Accept-Encoding", "gzip, deflate");
      httpPost.addHeader("User-Agent",
        "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");
      httpPost.addHeader("Host", HttpHost);
      httpPost.addHeader("Connection", "Keep-Alive");
    //  HttpHost httpProxy = new HttpHost("222.222.222.222", 1443, "http");
    //  httpClient.getParams().setParameter(AllClientPNames.DEFAULT_PROXY,httpProxy);
      StringBuffer params = new StringBuffer();
      String userName = "abin";
      String passWord= "varyall";
      String userAge= "12345";
      String homeTown= "china beijing";
      params.append("__userName ").append("=").append(userName )
        .append("&").append(passWord").append("=")
        .append(passWord).append("&").append("userAge")
        .append("=").append(userAge).append("&")
        .append("homeTown").append("=")
        .append(homeTown);
      HttpResponse httpResponse = null;
      String result = "";
      try {
       StringEntity reqEntity = new StringEntity(params.toString());
       httpPost.setEntity(reqEntity);
       HttpHost httpTarget = new HttpHost(HttpHost, 80, "http");
       httpResponse = httpClient.execute(httpTarget, httpPost);
       System.out.println("httpResponse=" + httpResponse.getStatusLine());

       BufferedInputStream buffer = new BufferedInputStream(httpResponse
         .getEntity().getContent());
       byte[] bytes = new byte[1024];
       int line = 0;
       StringBuilder builder = new StringBuilder();
       while ((line = buffer.read(bytes)) != -1) {
        builder.append(new String(bytes, 0, line));
       }
       result = new String(builder.toString());
      } catch (Exception e) {
       e.printStackTrace();
      } finally {
       if (httpPost.isAborted()) {
        httpPost.abort();
       }
       httpClient.getConnectionManager().shutdown();
      }
    //   System.out.println("result="+result);

     }

    }

    主站蜘蛛池模板: 亚洲精品国产精品| 亚洲国产精品久久久久久| 国产禁女女网站免费看| 亚洲人成网站免费播放| 欧洲乱码伦视频免费| 国产曰批免费视频播放免费s| 亚洲电影在线免费观看| 最近中文字幕2019高清免费| 97在线视频免费播放| 57pao一国产成视频永久免费| 免费看又黄又无码的网站| 在线a免费观看最新网站| 国产又大又粗又长免费视频| 在线看片无码永久免费视频| 色窝窝免费一区二区三区| 成年女人毛片免费播放人| 在线免费观看视频你懂的| 国产小视频免费观看| 亚洲XX00视频| 亚洲综合色婷婷七月丁香| 亚洲gv白嫩小受在线观看| 亚洲理论片中文字幕电影| 97久久国产亚洲精品超碰热| 亚洲AV第一成肉网| 一级毛片高清免费播放| 免费国产污网站在线观看| **一级毛片免费完整视| 妞干网在线免费观看| 婷婷亚洲天堂影院| 久久亚洲AV午夜福利精品一区| 亚洲最新中文字幕| 午夜亚洲国产理论片二级港台二级| 成人免费夜片在线观看| 免费成人在线电影| 久久综合AV免费观看| 亚洲国产av一区二区三区| 国产V亚洲V天堂无码久久久 | 99re6在线精品视频免费播放| 波多野结衣在线免费观看| 国产无遮挡吃胸膜奶免费看| 亚洲日韩精品一区二区三区|