zoukankan      html  css  js  c++  java
  • 抓取网页萃取网页内容的代码 选择自 liujien 的 Blog

    dim sUrl
     sUrl="http://travel.state.gov/visa/frvi_bulletincurrent.html"
     Function streamtochar(StrStream)
     set stream=CreateObject("ADODB.Stream")
     stream.type=1
     stream.Mode=3
     stream.Open
     stream.Write Strstream
     stream.Position= 0
     stream.Type= 2
     stream.Charset="gb2312"
     streamtochar= stream.ReadText
     stream.Close
     set stream=nothing
     End Function
     i = i + 1
     function getContentByUrl(url)
     set XmlHttp = CreateObject("MSXML2.XMLHTTP")
     XmlHttp.open "GET",url,false
     XmlHttp.send
     getContentByUrl = streamtochar(oXmlHttp.responseBody)
     set XmlHttp=nothing
     end function
    
     function getRealContent(url)
     sContent = getContentByUrl(url)
     getRealContent=sContent
     end function
    
    html= getContentByUrl(surl)
     url_start=inStr(html," " )  url_end=inStr(html," ")
     url=Mid(html,url_start,url_end-url_start)
     url=replace(url,"“) 
     Date_start=inStr(html,"Washington, D.C. ")+57
     Date_end=inStr(html," A. STATUTORY")-14
     Date_T=Mid(html,Date_start,Date_end-Date_start)
  • 相关阅读:
    Swift的函数与函数指针、闭包Closure等相关内容介绍
    spring+dubbo整合
    常用设计模式-适配器模式
    常用设计模式-工厂模式
    java动态代理
    程序对关系型数据库批量操作
    springboot整合mybatis
    JAVA代码实现多级树结构封装对象
    springboot集成redis缓存
    springboot入门
  • 原文地址:https://www.cnblogs.com/guola/p/400867.html
Copyright © 2011-2022 走看看