当前位置: 首页 > news >正文

宝安网站制作需要多少钱个人主页推荐

宝安网站制作需要多少钱,个人主页推荐,一般网站建设方案,报名网站辽宁省建设银行目录 一、爬虫的定义 二、获取数据 #xff08;1#xff09;基于Get方式的请求#xff08;无参#xff09; #xff08;2#xff09;基于Get方式请求#xff08;有参#xff09; #xff08;3#xff09;基于Post方式的请求#xff08;无参#xff09; … 目录 一、爬虫的定义 二、获取数据 1基于Get方式的请求无参 2基于Get方式请求有参 3基于Post方式的请求无参 4基于Post方式的请求有参 一、爬虫的定义 爬虫指的是一种自动化程序能够模拟人类在互联网上的浏览行为自动从互联网上抓取、预处理并保存所需要的信息。 爬虫运行的过程一般是先制定规则如指定要抓取的网址、要抓取的信息的类型等紧接着获取该网址的HTML源代码根据规则对源代码进行解析和抽取最后进行处理和保存。 爬虫在实际应用中广泛使用如搜索引擎、大数据分析、交易数据采集等领域都需要用到爬虫技术来实现信息的定向采集和处理 关于爬虫我们基本上可以分为两步第一是获取数据第二是解析数据 二、获取数据 1基于Get方式的请求无参 public static void main(String[] args) throws IOException {CloseableHttpClient httpClient HttpClients.createDefault();HttpGet httpGetnew HttpGet(https://www.lanqiao.cn/);//发送http中的get请求HttpEntity entitynull;CloseableHttpResponse responsenull;//判断是否得到正确的数据try {response httpClient.execute(httpGet);if(response.getStatusLine().getStatusCode()200){//获取响应数据entityresponse.getEntity();//获取的数据输出其实是个对象System.out.println(entity);//将响应数据以html源码形式展示String html EntityUtils.toString(entity, UTF-8);System.out.println(html);}}catch (Exception e){e.printStackTrace();}finally {try{if(response!null)response.close();//响应成功后关闭if(httpClient!null)httpClient.close();}catch(Exception e){e.printStackTrace();}}} 2基于Get方式请求有参 public static void main(String[] args) throws IOException {CloseableHttpClient httpClient HttpClients.createDefault();HttpGet httpGetnew HttpGet(https://www.lanqiao.cn/);//发送http中的get请求HttpEntity entitynull;CloseableHttpResponse responsenull;//判断是否得到正确的数据try {response httpClient.execute(httpGet);if(response.getStatusLine().getStatusCode()200){//获取响应数据entityresponse.getEntity();//获取的数据输出其实是个对象System.out.println(entity);//将响应数据以html源码形式展示String html EntityUtils.toString(entity, UTF-8);System.out.println(html);}}catch (Exception e){e.printStackTrace();}finally {try{if(response!null)response.close();//响应成功后关闭if(httpClient!null)httpClient.close();}catch(Exception e){e.printStackTrace();}}} 3基于Post方式的请求无参 public class HtppClientDemo1 {public static void main(String[] args) throws IOException {CloseableHttpClient httpClientHttpClients.createDefault();//创建post请求HttpPost httpPostnew HttpPost(https://www.lanqiao.cn/);HttpEntity entitynull;CloseableHttpResponse responsenull;try{responsehttpClient.execute(httpPost);if(response.getStatusLine().getStatusCode()200){//获取响应数据entityresponse.getEntity();System.out.println(entity);//网页源代码String htmlEntityUtils.toString(entity,UTF-8);System.out.println(html);}}catch(Exception e){e.printStackTrace();}finally {try{if(response!null)response.close();if(httpClient!null)httpClient.close();}catch (Exception e){e.printStackTrace();}}} 4基于Post方式的请求有参 public static void main(String[] args) {CloseableHttpClient httpClient HttpClients.createDefault();//创建post请求HttpPost httpPost new HttpPost(https://www.lanqiao.cn/);HttpEntity entity null;CloseableHttpResponse response null;try {//设置参数BasicNameValuePair basicNameValuePairnew BasicNameValuePair(progid,20);//装入集合ListBasicNameValuePair listnew ArrayList();list.add(basicNameValuePair);//开始进行参数请求进行网络请求UrlEncodedFormEntity urlEncodedFormEntitynew UrlEncodedFormEntity(list,UTF-8);httpPost.setEntity(urlEncodedFormEntity);//请求参数结束response httpClient.execute(httpPost);if (response.getStatusLine().getStatusCode() 200) {//获取响应数据entity response.getEntity();System.out.println(entity);//网页源代码String html EntityUtils.toString(entity, UTF-8);System.out.println(html);}} catch (Exception e) {e.printStackTrace();} finally {try {if (response ! null) response.close();if (httpClient ! null) httpClient.close();} catch (Exception e) {e.printStackTrace();}}}
http://www.dnsts.com.cn/news/218621.html

相关文章:

  • 孝感的网站建设网站服务器的重要性
  • 搜索引擎优化的主要工作seo排名优化什么意思
  • 通过ip访问网站需要怎么做wordpress阿里云数据库
  • 网站免费广告网络推广专员好做吗
  • 建站公司怎么获客asp.net jsp 网站开发
  • 博物馆网站做的最好的网站建设制作开发 小程序开发定制 软件系统开发
  • 建设家装网站国内免费建站网站
  • 中企动力做网站好吗可以做彩字的网站
  • 无网站做cpa品牌建设的重要性和必要性
  • 中国门户网站排行长春网站seo哪家好
  • 商城的网站统计如何做网站开发与部署
  • 自己做行程的网站人事管理系统
  • 杭州便宜的手机网站建设南京做公司网站的公司
  • 货运网站源码在火炉做网站公园坐什么车
  • asp网站开发环境cpu做网站seo怎么赚钱
  • 沈阳网络建网站个人网站内容如何优化
  • 用php制作一个个人信息网站找人做一个小网站需要多少钱
  • 兰州微信信息平台网站建设苏州建设网站找网络公司
  • 有什么网站可以做宣传图片设计图片素材网站有哪些
  • 食品网站建设策划方案通州区网站建设
  • 网站制作哪家最好网站建设开发方式包括哪些
  • 关于我们网站设计安徽安庆区号
  • 各网站封面尺寸wordpress怎么上传到服务器错误
  • 外贸公司网站建设方案推广普通话主题班会
  • 网站集约化建设情况汇报网站服务器维护费用
  • 属于网站建设过程规划工业和信息部网站备案
  • 2015 军考 网站建设推广怎么做才可以赚钱
  • 买服务器做网站湖南邵阳建设局网站
  • 全椒有做网站的吗wordpress静态网站博客
  • 成都优化网站源头厂家自助建站广告发布