• java 获取URL链接 内容


    public static String getHtmlConentByUrl(String ssourl) {
            try {    
             URL url = new URL(ssourl);
             HttpURLConnection con = (HttpURLConnection) url.openConnection();
                
             con.setInstanceFollowRedirects(false);
             con.setUseCaches(false);
             con.setAllowUserInteraction(false);
             con.connect();             
             StringBuffer sb = new StringBuffer();
             String line = "";
             BufferedReader URLinput = new BufferedReader(new InputStreamReader(con.getInputStream()));
             while ((line = URLinput.readLine()) != null) {
              sb.append(line);
             }
             con.disconnect();
           
             return sb.toString().toLowerCase();
             
            } catch (Exception e) {
              
             return null;
            }

    }

  • 相关阅读:
    2019年6月英语四六级试题及答案和视频教程
    经典解压缩软件 WinRAR 5.90 sc 官方去广告版
    会动的边框
    萌萌达机器人
    背景图片跟随鼠标动
    烟花代码
    常用正则表达式
    计算器
    顶部下啦菜单
    ps用画笔工具设计水墨圆环
  • 原文地址:https://www.cnblogs.com/austinspark-jessylu/p/6226099.html
Copyright © 2020-2023  润新知