一段从网页上偷数据的ASP程序。
<%
Const adTypeBinary = 1
Const adTypeText = 2
Function Bytes2bStr(vin)
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream")
With BytesStream
.Type = adTypeText
.Open
.WriteText vin
.Position = 0
.Charset = "GB2312"
.Position = 2
StringReturn = .ReadText
.close
End With
Set BytesStream = Nothing
Bytes2bStr = StringReturn
End Function
url="http://www.qx121.com/information/tqyb/shortnb_output.asp?"&time()&""
set oSend=createobject("Microsoft.XMLHTTP")
SourceCode = oSend.open ("GET",url,false)
oSend.send()
if err.number<>0 then
Response.write err.description
Response.End()
end if
SourceCode = bytes2BSTR(oSend.responseBody)
bodystart=instr(SourceCode,"</tr>-->")
bodyend1=instr(bodystart,SourceCode,"值班预报员")
if not bodyend1=0 then
bodyend=InstrRev(SourceCode,"</tr",bodyend1)
end if
if bodystart=0 or bodyend1=0 or bodyend=0 then
body="连接服务器时出错,请稍后再试!"
else
body=mid(SourceCode,bodystart+8,bodyend-bodystart-4)
end if
set SourceCode=nothing
'显示获取的内容,同样你也可以在这里写入库语句
response.Write(body)
%>
发表于 @ 2004年07月05日 18:20:00 | 评论( loading... ) | 举报| 收藏