隨筆 - 100  文章 - 50  trackbacks - 0
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          我收藏的一些文章!

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          /**
           *
           */
          package com.lin;

          import java.io.BufferedReader;
          import java.io.InputStreamReader;
          import java.io.PrintWriter;
          import java.net.HttpURLConnection;

          import javax.net.ssl.SSLHandshakeException;

          /**
           * @author lin
           *
           */
          public class TestURL {

           /**
            * @param args
            */
           public static void main(String[] args)   {
            String result = "";
            try {
             java.net.URL url = new java.net.URL("    HttpURLConnection httpConn = (HttpURLConnection) url
               .openConnection();
             httpConn.setDoOutput(true);
             httpConn.setDoInput(true);
             httpConn.setRequestMethod("POST");
             PrintWriter out = new PrintWriter(httpConn.getOutputStream());
             out.println("Email=test@gmail.com" +"password=123456");
             out.flush();
             out.close();
             BufferedReader in = new BufferedReader(new InputStreamReader(
               httpConn.getInputStream(), "UTF-8"));
             String line;
             while ((line = in.readLine()) != null) {
              result += line + "\n";
             }
             System.out.println("result: " + result);
             in.close();
              }catch(SSLHandshakeException se){
             System.out.println("error is open");
            }
            catch (Exception e) {
             System.out.println("sucess " + e);
            }

           }
          }

          主站蜘蛛池模板: 井研县| 咸阳市| 黄大仙区| 酒泉市| 肥乡县| 建德市| 绥棱县| 肇东市| 南康市| 闵行区| 台南市| 镇原县| 新田县| 通榆县| 台山市| 新巴尔虎左旗| 莱芜市| 门源| 巴林左旗| 新龙县| 北票市| 商丘市| 卢龙县| 武川县| 吉安市| 阿坝县| 江孜县| 墨竹工卡县| 涿鹿县| 阿拉善右旗| 毕节市| 乐东| 罗城| 曲麻莱县| 南京市| 岳普湖县| 永登县| 宝丰县| 全南县| 观塘区| 雷波县|