On the realization of automatic acquisition program and storage ASP

Source: Internet
Author: User
Tags chr sql split table name
Collection | procedure | Collection recently some collection programs are popular on the Internet. More people with these things on the internet, a lot of people who do not know how to look at those procedures to envy, in fact, if you understand some of the ASP, understand the principle of automatic acquisition program, you will feel the automation is also so simple.

Principle and Advantages: the XMLHTTP component in the XML is invoked on other Web pages, then the batch intercepts or replaces the original information so that it is converted into a variable and then one by one is stored in the database. The main advantage is that no need to manually add a lot of information, you can designate a station information interception for batch input, to save time and effort. Unlike the Simple ASP Thief program, it is no longer dependent on its target site.

Simple example:

1<%
2 ' declares a function that obtains the target information, which is implemented through an XML component.
3Function GetURL (URL)
4Set retrieval = CreateObject ("Microsoft.XMLHTTP")
5With Retrieval
6.Open "Get", url, False
7.Send
8GetURL = Bytes2bstr (. responsebody)
9 ' To obtain the information to verify, if the information length is less than 100 to indicate the interception failure
10if len (. responsebody) <100 Then
11response.write "Get remote file <a href=" &url& "target=_blank>" &url& "</a> failed. "
12response.end
13end if
14
15End with
16Set retrieval = Nothing
17End Function
18 ' binary turn string, otherwise there will be garbled!
19function Bytes2bstr (VIN)
20strreturn = ""
21for i = 1 to LenB (VIN)
22thischarcode = ASCB (MidB (vin,i,1))
23if Thischarcode < &h80 Then
24strreturn = Strreturn & Chr (Thischarcode)
25else
26nextcharcode = ASCB (MidB (vin,i+1,1))
27strreturn = Strreturn & Chr (CLng (thischarcode) * &h100 + CInt (nextcharcode))
28i = i + 1
29end if
30next
31bytes2bstr = Strreturn
32end function
33 ' Declaration intercept format, intercept from start, to end
34Function Getkey (Html,start,last)
35filearray=split (Html,start)
36filearray2=split (Filearray (1), last)
37getkey=filearray2 (0)
38End Function
39
40Dim Softid,url,html,title
41
42 ' Get the ID of the page to take
43
44softid=request ("Id")
45
Url= "http://www3.skycn.com/soft/" &SoftId& ". html"
47
+ Html = GetURL (URL)
49
50 ' software name for intercepting Sky Software as an example
51
Title = Getkey (Html, "<font color= ' #004FC6 ' size= ' 3 ' >", "</font></b></td></tr>")
53
54 ' Open database, ready for storage
55
56dim Connstr,conn,rs,sql
57
58connstr= "dbq=" +server.mappath ("Db1.mdb") + ";D efaultdir=;D river={microsoft Access DRIVER (*.mdb)};"
59
60set conn=server.createobject ("ADODB. CONNECTION ")
61
62conn.open ConnStr
63
64set rs=server.createobject ("Adodb.recordset")
65
66sql= "SELECT [column name] from [table name] where [column name]= '" ' &Title& ' "
67
68rs.open sql,conn,3,3
69
70if rs.eof and Rs.bof Then
71
72RS ("column name") =title
73
74rs.update
75
76set rs=nothing
77
78end if
79
80set rs=nothing
81
82response.write "Collection completed!"
83
84%>



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.