[VB] Get HTML Page Source

Soldato
Joined
12 Jun 2005
Posts
5,361
Hi there,

I am creating a little project to start myself off with Visual Basic6 (Yeah I know its old).

I need the program to download the source of a html page to a string.

How would i go about doing this?

Thanks.
 
Associate
Joined
23 Oct 2005
Posts
201
Location
North London
In VB6, go to project, then components and add the Microsft Internet Controls.

Drage a webbrowser control and a button onto your form. For the button click event handler, add the following.

Code:
WebBrowser1.Navigate2 ("http://www.google.com")
Do While Me.WebBrowser1.Busy: DoEvents: Loop
MsgBox Me.WebBrowser1.Document.documentElement.OuterHTML

There are other ways to do it, but I think this is the easiest.
 
Associate
Joined
1 Jan 2005
Posts
321
Location
Stoke
- Press ctrl + T and add the Microsoft Internet Transfer Control
- Drag the Inet control on to the form
- To use the control to get the source use the following:

Code:
page_source = Inet1.OpenURL("http://www.google.co.uk")

This should be the same as the other method and requires less effort...just the way it should be :p.
 
Back
Top Bottom