Call web pages on other websites through the XMLHTTP component in XML, and then intercept or replace the original information in batches to convert them into variables and then store them one by one in the database. Its main advantage is that there is no need to manually add a large amount of information. You can specify the interception of information from a certain station to be entered in batches, saving time and effort. The difference with its pure ASP thief program is that it no longer relies on its target website.
Reference code:
Copy the code code as follows:
<%
'Declares a function to obtain target information, implemented through XML components.
Function Geturl(/blog/url)
Set Retrieval = CreateObject(Microsoft.XMLHTTP)
With Retrieval
.Open GET, url, False
.Send
GetURL = bytes2bstr(.responsebody)
'Verify the obtained information. If the length of the information is less than 100, the interception fails.
if len(.responsebody)<100 then
response.write failed to obtain the remote file <a href=&url& target=_blank>&url&</a>.
response.end
end if
End With
Set Retrieval = Nothing
End Function
' Convert binary to string, otherwise garbled characters will appear!
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
'Declare the interception format, starting from Start and ending with 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
'Get the ID of the page you want to fetch
SoftId=Request(Id)
Url=http://www3.skycn.com/soft/&SoftId&.html
Html = Geturl(/blog/Url)
'Take the software name of intercepting the sky software as an example
Title = GetKey(Html,<font color='#004FC6' size='3'>,</font></b></td></tr>)
'Open the database and prepare to store it
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 [column name] from [table name] where [column name]='&Title&'
rs.open sql,conn,3,3
if rs.eof and rs.bof then
rs(column name)=Title
rs.update
set rs=nothing
end if
set rs=nothing
Response.Write collection completed!
%>