隨筆 - 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);
            }

           }
          }

          主站蜘蛛池模板: 洛隆县| 额敏县| 东乡族自治县| 济宁市| 朝阳区| 云梦县| 商水县| 合江县| 巴东县| 石台县| 凤台县| 西城区| 新龙县| 屏南县| 阿荣旗| 井研县| 大石桥市| 温泉县| 枣阳市| 都江堰市| 田林县| 固安县| 什邡市| 嘉兴市| 江口县| 呼玛县| 曲阜市| 马尔康县| 阿拉善左旗| 柘城县| 得荣县| 措美县| 房山区| 苗栗县| 延长县| 广元市| 平度市| 同江市| 元氏县| 马关县| 桐乡市|