"Reading" web page in VB6 - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: "Reading" web page in VB6 (/showthread.php?tid=82437)
"Reading" web page in VB6 by Salem on 03-18-2008 at 11:25 AM
Hi
Can anybody on here help me to "read" data in a webpage from within a VB6 application?
I've embedded a (hidden) WebBrowser control which is where the page will be loaded. I'd like to be able to "read" a piece of the info in the Web page for use within my VB app.
The info I'll be reading will either be in a <div> tag, or I can put it in a text box. whichever works best.
Thanks in advance. I know one of you very knowledgeable people will be able to help
~Salem
RE: "Reading" web page in VB6 by Mike on 03-18-2008 at 12:52 PM
You can get the source code of a website by using the Inet control:
Ctrl-T -> Microsoft Internet Transfer Control -> OK
Add one, and then to get the source code of a website use:
code: Dim strSourceCode as String
strSourceCode = Inet1.OpenURL("www.google.com")
Then, if the website's source code doesn't change too much, you can easily write some code that will get what you want
RE: "Reading" web page in VB6 by matty on 03-18-2008 at 01:05 PM
code: Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim HTML
HTML = pDisp.Document.body.innerhtml
Debug.Print HTML
End Sub
Can also do
code: Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print pDisp.Document.body.innerhtml
End Sub
|