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.
Thanks,
Jeff
Printable View
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.
Thanks,
Jeff
this usually requires advances parsing of the HTML source code from the page...
you will need to learn how to use instr$ and mid$ function to parse out parts of text
load the source page into a string first by using the internet transfer control, Inet
VB Code:
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
http://www.w3schools.com/vbscript/vb...ons.asp#string
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.
Thank you all for your help!
Hi..
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 ?
it is possibly to write a VB app to interact directly with the IE screens. field names are burried in forms... if you are looking at the same forms all the time, you "could" write another webpage to interact with it across the IE platform. you can use Javascript to grab info from another browser page and feed it to the page you are looking for.. use VBScript to insert it to a database...
Javascript : Document.DocumentTitle.FormName.FiledName = Data
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 ?