|
-
Nov 23rd, 2005, 09:41 AM
#1
Thread Starter
Junior Member
[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
-
Nov 23rd, 2005, 11:30 AM
#2
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:
'Code in your sub...
Dim returnstring As String
returnstring = SearchPage("http://www.yahoo.com")
'Function Code...
Private Function SearchPage(ByVal sURL As String) As String
Dim client As System.Net.WebClient = New System.Net.WebClient()
Dim data As System.IO.Stream = client.OpenRead(sURL)
Dim reader As System.IO.StreamReader = New System.IO.StreamReader(data)
SearchPage = reader.ReadToEnd
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...
-
Nov 29th, 2005, 01:19 PM
#3
Thread Starter
Junior Member
Re: Simple Question.. Reading from a web page...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|