Aug 7th, 2002, 11:18 AM
How can you extract data from a Web Page using VB?
Has anyone ever done this before. I have to write a program that requires data to be extracted from a web page and then loaded into a database. I have no idea how to do this.
Aug 7th, 2002, 11:23 AM
this usually requires advances parsing of the HTML source code from the page...
Aug 7th, 2002, 11:27 AM
you will need to learn how to use instr$ and mid$ function to parse out parts of text
Aug 7th, 2002, 11:37 AM
load the source page into a string first by using the internet transfer control, Inet
Dim htmlSource as String
htmlSource = Inet1.OpenURL("www.google.com")
Then have a look at the string parsing commands to "cut out" only the bit of the page you want. You could do worse than looking at the descriptions here
Then when you can extract the info you want out of your htmlSource string, and display it in a textbox in your vb app, start asking about creating an ADO connection to a database, and writing the value.
Get the data you want into a text box first in a vb app, then worry about the database connection.
Aug 7th, 2002, 12:36 PM
Thank you all for your help!
Aug 9th, 2002, 12:13 PM
another option is to use "screen scraping" techniques...
are you pulling data from the same pages all the time ? do they have fixed filed locations ?
in another direction, i am more curious about what you are tryinhg to acomplish. are you pulling info from pages taht are submitted to you ? or trying to do a search on the internet and extract information ?
i have written pages, and seen examples where you have 2 seperate browser windows and they intereact with each other through Javasacript... its pretty slick. if you are reading the same form all the time you know what to expect and where... or what the field names are...
and for that fact.. if it is something that needs to happen on a reoccouring time frame, you can set a timer on the page to auto update...
Does this help or give you another perspective ?
Click Here to Expand Forum to Full Width
Survey posted by VBForums.