<%Function GetPage(url)
Dim Retrieval
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function GetContent(str,start,last,n)
If Instr(lcase(str),lcase(start))>0 then
select case n
case 0
Rem 左右都截取(都取前面)(去处关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))-1)
case 1
Rem 左右都截取(都取前面)(保留关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))+Len(last)-1)
case 2
Rem 只往右截取(取前面的)(去除关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
end select
Else
GetContent=""
End if
End function
Function ReplaceStr(str,start,last)
Rem str 变量名称 start 要过滤的字符 last 要替换的字符
ReplaceStr=Replace(str,start,last)
End Function
Function BytesToBstr(body)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Rem 检测是否有汉字
Function RegChinese(str)
Dim regEx, retVal
Set regEx = New RegExp
regEx.Pattern = "^[^u0000-u00FF]*quot;
regEx.IgnoreCase = False
retVal = regEx.Test(str)
If retVal Then
RegChinese = True
Else
RegChinese = False
End If
End Function
function rep(Str)
rep=replace(replace(replace(str,chr(34),"") ,CHR(13),""),chr(10),vbCrLf)
end function
%>
(责任编辑:admin) |