Some of the experience of collecting, the novice hope to be able to pocket less circle

Source: Internet
Author: User
Acquisition

To decide the original Super Practical technology: Do your own collection


In fact, I think this paste must be added points, can even add essence, I wrote the story is a failure of the story will not help everyone so today to give you some practical points, I wrote n the undersecretary of the article, this time to write a long article, did not write a short, although for many veterans is not what but I know for beginners is very important, is to teach you

How to order to do the collector, the technology to you, first of all, I first to introduce you to a few commonly used functions.
You might ask, what exactly is a function? Yes, the novice. Some are given functions and will not be used, I am also the same as before, so I will explain in detail. Post it first:
The first is: the function of fetching Web page content with XML
Function getpage (URL)
Set retrieval = CreateObject ("Microsoft.XMLHTTP")
With retrieval
. Open "Get", url, False, "", ""
. Send
GetPage = Bytestobstr (. Responsebody)
End With
Set retrieval = Nothing
End Function

How does this function work? The usage is this, first must define first, when you want to use, you getpage then the parentheses, then writes the website in the parenthesis. Note that if the URL is

Characters rather than functions, they should be enclosed in "double quotes, and if it's a variable, it's not necessary, if it's a character alphanumeric variable, add an ampersand in the middle. For example I want to get

Http://www.abc.com/abc/abc.htm of the content of the words written getpage ("http://www.abc.com/abc/abc.htm") of course, can not be used alone to use the time to assign him

Value to the variable, such as the variable is a, that is GetPage ("http://www.abc.com/abc/abc.htm"), hehe.

The second function is to get the content you need.
Function getcontent (Str,start,last,n)
If Instr (LCase (str), LCase (start)) >0 Then
Select Case N
Case 0 ' All intercept (all take the front) (Place keyword)
Getcontent=right (Str,len (str)-INSTR (LCase (str), LCase (start))-len (start) +1)
Getcontent=left (Getcontent,instr LCase (getcontent), LCase (last))-1)
Case 1 ' Both intercept (all front) (Reserved keyword)
Getcontent=right (Str,len (str)-INSTR (LCase (str), LCase (start)) +1)
Getcontent=left (Getcontent,instr (LCase (getcontent), LCase (last)) +len (last)-1)
Case 2 ' only intercepts to the right (take the front) (Remove the keyword)
Getcontent=right (Str,len (str)-INSTR (LCase (str), LCase (start))-len (start) +1)
Case 3 ' only to the right (take the front) (contains the keyword)
Getcontent=right (Str,len (str)-INSTR (LCase (str), LCase (start)) +1)
Case 4 ' only intercepts to the left (takes the following) (contains the keyword)
Getcontent=left (Str,instrrev (LCase (str), LCase (start)) +len (start)-1)
Case 5 ' only to the left (take back) (remove the keyword)
Getcontent=left (Str,instrrev (LCase (str), LCase (Start))-1)
Case 6 ' only intercepts to the left (takes the front) (contains the keyword)
Getcontent=left (STR,INSTR (LCase (str), LCase (start)) +len (start)-1)
Case 7 ' only intercepts to the right (takes the following) (contains the keyword)
Getcontent=right (Str,len (str)-instrrev (LCase (str), LCase (start)) +1)


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.