抓取网页萃取网页内容的代码

类别:Asp 点击:0 评论:0 推荐:
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," " )

本文地址:http://com.8s8s.com/it/it7689.htm