The principle and simple example of implementing Thief Program in ASP

Source: Internet
Author: User

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
%

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.