Now online more popular thief program, there are news thieves, music thieves, download thieves, then they are how to do it, I would like to do a simple introduction, I hope to help you webmaster.
(i) principle
The thief program actually invokes pages on other Web sites through the XMLHTTP component in the XML. For example, the News thief program, many are called Sina's news page, and some of the HTML is replaced, while the ads also filtered. The advantages of using a thief program are: no maintenance site, because the Thief program data from other sites, it will be updated with the site update, you can save server resources, the General Thief program on several files, all Web content is from other sites. Disadvantages are: Instability, if the target site error, the program will also be wrong, and, if the target site to upgrade maintenance, then the thief program to make the corresponding changes; speed, because it is a remote call, speed and read data on the local server, it must be slower.
(ii) case
The following is a brief description of the application of XMLHTTP in ASP
<%
' common function
' 1, enter URL destination page address, return value Gethttppage is the HTML code for the target page
function gethttppage (URL)
Dim Http
Set Http=server.createobject ("Msxml2.xmlhttp")
Http.open "Get", Url,false
Http.send ()
If Http.readystate <> 4 Then
Exit Function
End If
Gethttppage=bytestobstr (http.responsebody, "GB2312")
Set http=nothing
If Err.Number <> 0 Then err. Clear
End Function
' 2, convert XMLHTTP, directly using the Web page with Chinese characters will be the chaos, can be converted through the ADODB.stream component
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 = no
end Function
' try to invoke http://www.3doing.com/earticle/Html content
Dim url,html
Url= "http://www.3doing.com/earticle/"
HTML = gethttppage (URL)
Response.Write Html
%