错误类型:
Microsoft VBScript 运行时错误 (0x800A0005)
无效的过程调用或参数: 'Mid'
/zhuaqu1.asp, 第 51 行
我的程序如下,
<%@language=vbscript%>
<!--#include file=conn22.asp-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<body>
<%
function getHTTPPage(url) '通过组件Msxml2.XMLHTTP抓取网页内容
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.open "get",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn) '把抓取到的内容转化为文本
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode<&H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
dim xurl
xurl="http://sx.zsedu.net/"
strContent=getHTTPPage(xurl)
strContent=Replace(strContent," ","")
pos1=1
do while pos1 > 0
%>
<%
pos1 = InStr(1, strContent, "<", vbTextCompare)
pos2 = InStr(1, strContent, ">", vbTextCompare)
if pos1 > 0 and pos2 > 1 then
title = Mid( strContent, pos1, pos2 - pos1+1 )
strContent=Replace(strContent,title,"")
end if
%>
<%
loop
%>
<%
strContent=Replace(strContent," ","")
response.write(strContent)
dim visitors
whichfile=server.mappath("zhuaqu\zhuaqu.txt")
set qfs=server.createobject("Scripting.FileSystemObject")
set thisfile=qfs.opentextfile(whichfile)
visitors=thisfile.readline
thisfile.close
visitors=strContent
visitors=Replace(visitors," ","")
set out=qfs.createtextfile(whichfile)
out.writeline(visitors)
out.close
set fs=nothing
strtable="b"
set rs=server.createobject("adodb.recordset")
rs.open strtable,conn22,1,3
rs.addnew
rs("pinming")=strContent
rs("huohao")="11"
rs("jiage")="sa"
rs("miaosu")="df"
rs.update
rs.close
set rs=nothing
%>
</body>
</html>
翻翻过去那场雪
慕尼黑8549860
相关分类