2020
10-08
10-08
java爬虫之使用HttpClient模拟浏览器发送请求方法详解
0.摘要0.1添加依赖<dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.5.2</version></dependency>0.2代码//1.打开浏览器创建httpclient对象CloseableHttpClienthttpClient=HttpClients.createDefault();//2.输入网址HttpGethttpGet=newHttpGet("http://www.baidu.com");//3.发送请求CloseableHttpResponsehttpResponse=httpClient.execute(httpGet)...
继续阅读 >