ASP 자동 채집 실현 코드

2408 단어 ASP자동 채집
그 주요 장점 은 더 이상 손 으로 대량의 정 보 를 추가 하지 않 아 도 특정한 사이트 의 정 보 를 캡 처 하여 대량으로 입력 하여 시간 을 절약 하 는 목적 을 달성 할 수 있다 는 것 이다.단순 한 ASP 도둑 프로그램 과 달리 목표 사이트 에 더 이상 의존 하지 않 는 다.참조 코드:
 
<%
' , XML 。
Function Geturl(/blog/url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False
.Send
GetURL = bytes2bstr(.responsebody)
' , 100
if len(.responsebody)<100 then
response.write " <a href="&url&" target=_blank>"&url&"</a> 。"
response.end
end if
End With
Set Retrieval = Nothing
End Function

' , !
function bytes2bstr(vin)
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

' , Start , Last
Function GetKey(HTML,Start,Last)
filearray=split(HTML,Start)
filearray2=split(filearray(1),Last)
GetKey=filearray2(0)
End Function

Dim Softid,Url,Html,Title
' ID
SoftId=Request("Id")
Url="http://www3.skycn.com/soft/"&SoftId&".html"
Html = Geturl(/blog/Url)
'
Title = GetKey(Html,"<font color='#004FC6' size='3'>","</font></b></td></tr>")

' ,
dim connstr,conn,rs,sql
connstr="DBQ="+server.mappath("db1.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
set rs=server.createobject("adodb.recordset")
sql="select [ ] from [ ] where [ ]='"&Title&"'"
rs.open sql,conn,3,3
if rs.eof and rs.bof then
rs(" ")=Title
rs.update
set rs=nothing
end if
set rs=nothing
Response.Write" !"
%>

좋은 웹페이지 즐겨찾기