public String doSingleLink(String url, String loginsuccess, String jsTxt,String email,String pwd)
            throws IOException {
        // 读取登录页面内容
        URL serviceIpUrl = new URL(url);
        URLConnection connection = serviceIpUrl.openConnection();
        connection.setRequestProperty("method", "post");
        connection.connect();
        InputStreamReader isr = null;
        BufferedReader br = null;
        String loginTxt = "";
        InputStream is = connection.getInputStream();
        is = connection.getInputStream();
        isr = new InputStreamReader(is,"utf-8");
        br = new BufferedReader(isr);
        String str = "";
        try {
            while ((str = br.readLine()) != null) {
                loginTxt += str + "\r\n";
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        br.close();
        is.close();
        return loginTxt;
    }

简单记下。

posted on 2013-03-12 13:38  youngjoy  阅读(286)  评论(0编辑  收藏  举报