Results 1 to 3 of 3

Thread: [Resolved] Simple Question.. Reading from a web page...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    23

    Resolved [Resolved] Simple Question.. Reading from a web page...

    Ok, I'm quite sure this is a lot easier than it sounds, but can anyone point me at how to read information from an outside web page? I.e., check http://www.somestupidwebpage.com for the words "Updated Available", then read the update number after it, or such? Or, even just check the properties from a web page, to see the date of the last update.

    I'm 1/2 way worried this requires building my own baby browser; when I last played with VB (VB 5), it looked that way.. Any easy way to do it now?

    Thanks!
    Last edited by hamsterhuey; Nov 29th, 2005 at 01:19 PM. Reason: Resolved

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Simple Question.. Reading from a web page...

    Well here's a little code you can use to read in the contents of the URL into one string, then it would be a matter of parsing the data (or searching the text) for those particular words, or the data you need...
    VB Code:
    1. 'Code in your sub...
    2. Dim returnstring As String
    3. returnstring = SearchPage("http://www.yahoo.com")
    4.  
    5. 'Function Code...
    6. Private Function SearchPage(ByVal sURL As String) As String
    7.         Dim client As System.Net.WebClient = New System.Net.WebClient()
    8.         Dim data As System.IO.Stream = client.OpenRead(sURL)
    9.         Dim reader As System.IO.StreamReader = New System.IO.StreamReader(data)
    10.         SearchPage = reader.ReadToEnd
    11. End Function
    That works fine and dandy if your connection is up and the site is found, might need to add some extra code to handle the cases where there is no connection found or no site found at that address...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    23

    Re: Simple Question.. Reading from a web page...

    Thanks for the help!

Posting Permissions

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



Click Here to Expand Forum to Full Width