Hi,
Can anyone please write a sample program for me telling how to read html sourcecode? I get really confused when people just give a function and nothing else cause I dont know too much.
Thanks
Printable View
Hi,
Can anyone please write a sample program for me telling how to read html sourcecode? I get really confused when people just give a function and nothing else cause I dont know too much.
Thanks
You can do it through a few ways.
1) MSInet Control (not reliable)
2) Winsock
3) URLDownloadToFile API function
4) WebBrowser Control:
Code:Private Sub Command1_Click()
Text1.Text = WebBrowser1.Document.DocumentElement.innerHTML
End Sub
4a)
Code:Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Function GetHTML(site As String) As String
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate (site)
Do While IE.busy = True
Sleep 500
Loop
GetHTML = IE.Document.body.innerhtml
Set IE = Nothing
End Function
Usage
Private Sub Command1_Click()
Text1.Text = GetHTML("http://www.vb-world.net")
End Sub