XMLHTTP婁혤陶넋鑒앴돨빈퍅뇹잿

2018-09-06 12:04

阅读:300

  <%
hehe=Hello(
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&regEx.Replace(Match.Value,replStr)
Next
EndFunction

FunctionGetBody(Url)
SetobjXML=createObject(Microsoft.XMLHTTP)
WithobjXML
.OpenGet,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(


评论


亲,登录后才可以留言!