通过url抓获得到的html
来源:互联网 发布:三十后换工作 知乎 编辑:程序博客网 时间:2024/06/05 08:30
需要的jar包
httpclient-4.5.jar
httpcore-4.4.1.jar
public static String findUrlHtml(String url, String encoding) { String html = null; CloseableHttpResponse response = null; CloseableHttpClient httpclient = HttpClients.createDefault(); try { HttpUriRequest request = new HttpGet(url); response = httpclient.execute(request); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream input = entity.getContent(); try { html = IOUtils.toString(input, encoding); } finally { input.close(); } } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (response != null) { response.close(); } } catch (IOException e) { e.printStackTrace(); } } return html; }
阅读全文
0 0
- 通过url抓获得到的html
- C# 通过URL得到图片的问题
- 通过window.open跳转得到上一个页面的URL
- AS 通过URL 得到对应的Drawable资源
- 通过图片url,得到Bitmap对象
- 根据Html解析得到url和内容
- 通过JS获取url传递的参数(html可用)
- android:通过html中的Url打开APP的某个页面
- 通过js去掉所有的html标签,得到HTML标签中的所有内容
- 解决通过this.class.getResource()得到的URL中含有空格为乱码的问题
- 得到自身的Html
- 根据Url地址得到网页的html源码,截取网站信息的核心程序
- 在ASP.NET里通过URL传递参数得到乱码的解决方法
- 通过URL从Temporary Internet Files得到本地文件路径的函数
- 通过URL从Temporary Internet Files得到本地文件路径的函数
- 通过CHtmlView::GetHtmlDocument函数得到HTML源文件
- php 得到当前的URL
- 通过Javascript得到URL中的参数(query string)
- mybatis的坑
- 粒子群算法的matlab实现(一)
- mysql Slave_IO_Running:NO(解决方法)
- Kotlin学习之-5.8 泛型
- Oracle使用MOD函数(取余函数)
- 通过url抓获得到的html
- 22day 遇到的问题 \内存管理
- Python,set数据类型
- 国内如何打开SnapChat(阅后即焚)——针对安卓
- Retrofit2.0使用详解
- topk在mapreduce下面的统计加排序的实现
- ASM 异常 ORA-00020: maximum number of processes (100) exceeded
- 开机自动启动app,后台保持运行Service
- 华为OJ 字符串加解密