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.