How can you extract data from a Web Page using VB?-VBForums
Results 1 to 6 of 6

Thread: How can you extract data from a Web Page using VB?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2001
    Location
    Southern California
    Posts
    733

    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.

    Thanks,
    Jeff

  2. #2
    Moderator.NET kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,227
    this usually requires advances parsing of the HTML source code from the page...
    Using VS.NET 2013/.NET 2.0 through 4.5 * Please mark you thread resolved using the Thread Tools above
    PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!!
    * If you found a post useful then please Rate it! * DO NOT PM ME WITH LINKS TO YOUR THREADS FOR ANSWERS PLEASE!

    Code Bank:Manipulate HTML Page content in the Web Browser Control from VB - Drag Drop from Windows into Win Form - Launch new default browser instance to open URL - Display Internet Image in Picturebox - Download Files From Web With Progress Bar - IP Textbox User Control - Installing .NET Framework with INNO Setup
    ZerosAndTheOne.com
    -=Matt=-

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    you will need to learn how to use instr$ and mid$ function to parse out parts of text
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Addicted Member chicocouk's Avatar
    Join Date
    Sep 2001
    Posts
    207
    load the source page into a string first by using the internet transfer control, Inet

    VB Code:
    1. Dim htmlSource as String
    2. 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.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2001
    Location
    Southern California
    Posts
    733
    Thank you all for your help!

  6. #6
    Member
    Join Date
    Aug 2002
    Location
    Indianapolis In, lookin for a Good Woman !~
    Posts
    48

    Another Option

    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 ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.