There are many popular thief programs on the Internet now, including news thieves, music thieves, and download thieves. So how do they do it? I will give a brief introduction below, hoping that it will be helpful to all webmasters.
(I) Principle
The thief program actually calls web pages on other websites through the XMLHTTP component in XML. For example, in the news thief program, many of them call Sina's news pages, and some replacements are made to the html in it, and the advertisements are also filtered. The advantages of using a thief program are: there is no need to maintain the website, because the data in the thief program comes from other websites, and it will be updated as the website is updated; it can save server resources. Generally, the thief program only has a few files, and all web page content comes from other websites. Disadvantages include: unstable. If the target website errors, the program will also be errored. Moreover, if the target website is upgraded and maintained, the thief program must also be modified accordingly. The speed is because it is a remote call, and the speed is definitely slower than reading data on the local server.
(II) Example
Here is a brief explanation of the application of XMLHTTP in ASP
Code: <%
'Common functions
'1. Enter the URL destination web page address, and the return value getHTTPPage is the html code of the destination web page
functiongetHTTPPage(url)
dimHttp
setHttp=server.createobject("MSXML2.XMLHTTP"
Http.open"GET",url,false
Http.send()
ifHttp.readystate<>4then
exitfunction
endif
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312"
setthttp=nothing
iferr.number<>0thenerr.Clear
endfunction
'2. Convert Lanma, directly call a web page with Chinese characters with xmlhttp, you will get Lanma, which can be converted through the adodb.stream component.
FunctionBytesToBstr(body,Cset)
dimobjstream
setobjstream=Server.CreateObject("adodb.stream"
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.Writebody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
setobjstream=nothing
EndFunction
'The following is to try calling the html content of http://www.998w.net/class/
DimUrl,Html
Url="http://www.998w.net/class/"
Html=getHTTPPage(Url)
Response.writeHtml
%>
------------------------------------------------------
Code:
'Code reads remote files with XMLHTTP
<%
Response.Buffer=True
DimobjXMLHTTP,xml
Setxml=Server.CreateObject("Microsoft.XMLHTTP"
xml.Open"GET","http://www.998w.net/down/998w1.0.rar",False
xml.Send
'Addaheadertogiveitafilename:
Response.AddHeader"Content-Disposition",_
"attachment;filename=mitchell-pres.zip"
'Specify thecontenttypetotell thebrowserwhattodo: