(1) Principle:
The thief program actually calls the webpage on other websites through the XMLHTTP component in XML. For example, many news thief programs call Sina's news webpage, and replace some HTML in it, and also filter the advertisement. The advantages of the thief program are: there is no need to maintain the website, because the data in the thief program comes from other websites, it will be updated as the website is updated; it can save server resources. Generally, there are several files on the thief program. All webpage content is the content of all webpages. From other websites. The disadvantages are: unstable. If the target website is wrong, the program will be wrong, and if the target website is upgraded and maintained, the thief program must be modified accordingly; Compared to it, it must be slower.
(2) Case:
Let's make a brief explanation in the application of XMLHTTP in ASP:
1. Enter the URL target web address, and return value gettppage is the HTML code of the target webpage
| The following is the reference content: 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 the err.clear end function |
2. Change the chaos, directly use XMLHTTP to call the webpage with Chinese characters, and it will be obtained.
| The following is the reference content: Function Bytestobstr (Body, CSET) dim objstream set objstream = Server.createObject (Adodb.Stream) objstream.type = 1 objstream.mode = 3 objstream.open objstream.write? objstream.position = 0 objstream.type = 2 objstream.charset = CSET Bytestobstr = Objstream.readtext objstream.close set objstream = Nothing End function |
Try to call html content of http://www.vevb.com/js/
| The following is the reference content: Dim url, html Url = http://www.vevb.com/js/ Html = Gethttppage (url) Response.write html |