|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
想法是和程序员的想法不一样的.至于为什么.大家去想一想.跟心理学有关的xml|数据<%
作者信息:
昵称:小灰
QQ:103895
http://asp2004.net
http://blog.csdn.net/iuhxq
hehe=Hello("http://mmsg.qq.com/cgi-bin/gddylist?Type=13&Sort=1&Page=3","<html>","</html>",".*(<tdwidth=""35%""bgcolor=""#[dABCDE]{6}"">(.*)</td>)[.
]*","<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>)[.
]*","<fontstyle=""font-size:9pt;""color=blue>$2</font><br>")
</p>asp对于服务器的要求较高,一般的服务器如果访问量一大就垮了,不得不重启。 |
|