[Reprinted] comparison of webbrowser, innet, and XMLHTTP webpage source code!

Source: Internet
Author: User

Webbrowser:
Example:
For I = 0 to webbrowser1.document. All. Length-1
If webbrowser1.document. All (I). tagname = "html" then
Strcontent = strcontent & webbrowser1.document. All (I). innerhtml
Exit
End if
Next

Inet:
Example:
Method 1: inet1.openurl (strurl, icbytearray)
Method 2: inet1.execute strurl, "get"
I personally prefer to use the second type. Although it is troublesome, it is easier to control the handling of Chinese characters and errors during running,

XMLHTTP:
Example:
Set xmlobject = Createobject ("Microsoft. XMLHTTP ")
Xmlobject. Open "get", strurl, false
Xmlobject. Send
If xmlobject. readystate = 4 then
Strhtml = xmlobject. responsetext
End if

This is probably the above method. Some other types of webbrowser are not listed unless they are commonly used. To compare them, webbrowser needs to get the webpage source code through the 2nd object. If the remote file is large, it takes a lot of time for the document object to obtain the tagname. Execute of innet reads the Code of the specific obtaining method, which uses do .. loop, which must affect the running of the entire Program . Next, let's take a look at XMLHTTP, which I like most. It only takes a short 6 lines to complete the work that can be completed by the preceding two controls with so many statements and multi-event cooperation. We cannot set up an environment to test the running efficiency of the three controls at the same time, but I believe XMLHTTP is the best and most effective method.

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.