以下是抓取CSDN上的一篇文章,没有包含图片~~
Function GetBody(Url)
Set objXML = CreateObject("Microsoft.XMLHTTP")
With objXML
.Open "Get", Url, False, "", ""
.SEnd
GetBody = .ResponseBody
End With
GetBody = BytesToBstr(GetBody, "GB2312")
Set objXML = Nothing
End Function
Function BytesToBstr(strBody, CodeBase)
Set objStream = Server.CreateObject("Adodb.Stream")
With objStream
.Type = 1
.Mode = 3
.Open
.Write strBody
.Position = 0
.Type = 2
.Charset = CodeBase
BytesToBstr = .ReadText
.Close
End With
Set objStream = Nothing
End Function
strUrl="http://dev.csdn.net/article/69/69895.shtm"
PageCode=GetBody(strUrl)
TStart="id=""ArticleTitle1_ArticleTitle1_lblTitle"">"
TEnd="</span></b> "
CStart="id=""ArticleContent1_ArticleContent1_lblContent"">"
CEnd="</span>"&vbCrLf&"<br />"&vbCrLf&"<div style=""font-size: 14px; line-height: 25px;""><strong>"
Function MyMid(strContent,strStart,strEnd)
If(strStart="") Then
i=0
Else
i=Instr(strContent,strStart)+LEN(strStart)
End If
If(strEnd="") Then
j=LEN(strContent)
Else
j=Instr(strContent,strEnd)
End If
MyMid = Mid(strContent, i, j-i)
End Function
'Response.Write MyMid(PageCode,TStart,TEnd)
'Response.Write MyMid(PageCode,CStart,CEnd)
Title=MyMid(PageCode,TStart,TEnd)
Content=MyMid(PageCode,CStart,CEnd)
Response.Write Title&"<BR>"&Content
如果有图片的内容,加上下面的代码,结合即可
<%
const savepath="images/" '图片保存路径
function myreplace(str)
newstr=str
set objregEx = new RegExp
objregEx.IgnoreCase = true
objregEx.Global = true
objregEx.Pattern = "http://(.+?)/.(jpg|gif|png|bmp)" '定义文件后缀
set matches = objregEx.execute(str)
for each match in matches
newstr=replace(newstr,match.value,saveimg(match.value))
next
myreplace=newstr
end function
a=myreplace("http://www.wzall.com/fenlei/images/top_logo.jpghttp://www.wzall.com/cy/pic/200621511124416943.gif")
function saveimg(url)
temp=split(url,".")
'以下是用时间与随机数重命名文件名
randomize
ranNum=int(90000*rnd)+10000
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&temp(ubound(temp))
'文件名重命名结束
set xmlhttp=server.createobject("Microsoft.XMLHTTP")
xmlhttp.open "get",url,false
xmlhttp.send
img=xmlhttp.ResponseBody
set xmlhttp=nothing
set objAdostream=server.createobject("ADODB.Stream")
objAdostream.Open()
objAdostream.type=1
objAdostream.Write(img)
objAdostream.SaveToFile(server.mappath(savepath&filename))
objAdostream.SetEOS
set objAdostream=nothing
end function
%>
这样就可以实现小偷的程序及保存远程图片到本地,MP3,RM,等。。。。。