asp獲取遠(yuǎn)程網(wǎng)頁的指定內(nèi)容
用ASP獲取遠(yuǎn)程網(wǎng)頁的指定內(nèi)容,可以輕易獲取到別人網(wǎng)頁的指定的某些內(nèi)容,其實(shí)也就是ASP小偷程序原理了,代碼如下:
<% 
'用ASP獲取遠(yuǎn)程目標(biāo)網(wǎng)頁指定內(nèi)容,代碼由廣州網(wǎng)站建設(shè)http://www.studstu.com提供
On Error Resume Next 
Server.ScriptTimeOut=9999999 
Function getHTTPPage(Path) 
        t = GetBody(Path) 
        getHTTPPage=BytesToBstr(t,"GB2312") 
End function
Function Newstring(wstr,strng) 
        Newstring=Instr(lcase(wstr),lcase(strng)) 
        if Newstring<=0 then Newstring=Len(wstr) 
End Function
Function BytesToBstr(body,Cset) 
        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 = Cset 
        BytesToBstr = objstream.ReadText  
        objstream.Close 
        set objstream = nothing 
End Function 
Function GetBody(url)  
        on error resume next 
        Set Retrieval = CreateObject("Microsoft.XMLHTTP")  
        With Retrieval  
        .Open "Get", url, False, "", ""  
        .Send  
        GetBody = .ResponseBody 
        End With  
        Set Retrieval = Nothing  
End Function
'ASP獲取遠(yuǎn)程網(wǎng)頁指定內(nèi)容開始
Dim wstr,str,url,start,over,dtime 
a="開始內(nèi)容"         'ASP獲取目標(biāo)網(wǎng)頁內(nèi)容開始標(biāo)記
b="結(jié)束內(nèi)容"         'ASP獲取網(wǎng)頁內(nèi)容結(jié)束標(biāo)記
url="http://www.studstu.com/" 
        wstr=getHTTPPage(url) 
        start=Newstring(wstr,a) 
        over=Newstring(wstr,b) 
 body=mid(wstr,start,over-start) 
response.write ""&body&"" '輸出獲取到的網(wǎng)頁內(nèi)容
'ASP獲取遠(yuǎn)程網(wǎng)頁指定內(nèi)容結(jié)束
%>


