时间:2021-05-25
<%
hehe=Hello("http://mmsg.qq.com/cgi-bin/gddylist?Type=13&Sort=1&Page=3","<html>","</html>",".*(<tdwidth=""35%""bgcolor=""#[\dABCDE]{6}"">(.*)</td>)[.\n]*","<fontstyle=""font-size:9pt;""color=blue>$2</font><br>")
response.Writehehe
FunctionHello(strUrl,strStart,strEnd,patrn,replStr)
Str=GetBody(strUrl)
Str=MyMid(Str,strStart,strEnd)
Str=ReplaceTest(patrn,replStr,Str)
Hello=Str
EndFunction
FunctionMyMid(Str,strstart,strend)
Ifstrstart=""Then
i=0
Else
i=InStr(Str,strstart)
EndIf
Ifstrend=""Then
j=Len(Str)
Else
j=InStr(i,Str,strend)
EndIf
MyMid=Mid(Str,i,j-i+1)
EndFunction
FunctionReplaceTest(patrn,replStr,str1)
DimregEx,match,matches
SetregEx=NewRegExp
regEx.Pattern=patrn
regEx.IgnoreCase=True
regEx.Global=True
Setmatches=regEx.Execute(str1)
ForEachmatchinmatches
ReplaceTest=ReplaceTest®Ex.Replace(Match.Value,replStr)
Next
EndFunction
FunctionGetBody(Url)
SetobjXML=createObject("Microsoft.XMLHTTP")
WithobjXML
.Open"Get",Url,False,"",""
.SEnd
GetBody=.ResponseBody
EndWith
GetBody=BytesToBstr(GetBody,"GB2312")
SetobjXML=Nothing
EndFunction
FunctionBytesToBstr(strBody,CodeBase)
SetobjStream=Server.createObject("Adodb.Stream")
WithobjStream
.Type=1
.Mode=3
.Open
.WritestrBody
.Position=0
.Type=2
.Charset=CodeBase
BytesToBstr=.ReadText
.Close
EndWith
SetobjStream=Nothing
EndFunction
%>
其他调用示例:
hehe=Hello("http://list.mp3.baidu.com/song/A.htm","<tablewidth=""90%""border=""0""align=""center""cellpadding=""3""cellspacing=""0""bgcolor=""#f5f5f5"">","<DIValign=center>",".*(<tdwidth=""20%""><ahref="".*\.htm""target=_blank>)(.*)(</a></td>)[.\n]*","<fontstyle=""font-size:9pt;""color=blue>$2</font><br>")
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
这里所说的“小偷”指的是在ASP中运用XML中的XMLHTTP组件提供的强大功能,把远程网站上的数据(图片,网页及其他文件)抓取到本地,经过各种处理后显示到页面
这里所说的“小偷”指的是在asp中运用xml中的xmlhttp组件提供的强大功能,把远程网站上的数据(图片,网页及其他文件)抓取到本地,经过各种处理后显示到页面
xmlHTTP技术:----------------------------------------------------------一、数据库远程管理技术基
前言大家在做数据抓取的时候,经常遇到由于网络问题导致的程序保存,先前只是记录了错误内容,并对错误内容进行后期处理。原先的流程:defcrawl_page(url
利用xmlhttp对象获取远程的数据,然后用二进制输出到客户浏览器,让客户下载数据,此例从某一远程服务器获取一个压缩包,并且输出到浏览器提供客户下载.程序代码: