program | The thief program is now on the Internet popular Thief program More, there are news class 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 functions
' 1, enter URL target page address, return value Gethttppage is the HTML code of 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, the conversion of XMLHTTP, directly with the use of Chinese characters to call the Web page will be 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 = Nothing
End Function
' Try to invoke http://www.3doing.com/earticle/HTML content below
Dim url,html
Url= "http://www.3doing.com/earticle/"
Html = Gethttppage (URL)
Response.Write Html
%>