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

王朝html/css/js·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

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)

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有  導航