By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,652 Members | 1,451 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,652 IT Pros & Developers. It's quick & easy.

How Can I Read a Web Page?

P: n/a
I want to read a web page. That is, I have a URL and I want to read
the HTML and parse it and put the info into a data base. I've never
done any TCP/IP programming.

Thanks to a recent post here I am aware of the System.Web.*
namespaces, but I've looked through some of them and they all seem to
be server-side oriented. I need the kind of code used by the
client/browser side.

Thanks, Bob
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"eBob.com" <eB******@totallyfakeisp.com> schrieb:
I want to read a web page. That is, I have a URL and I want to read
the HTML and parse it and put the info into a data base. I've never
done any TCP/IP programming.


\\\
Imports System.IO
Imports System.Net
..
..
..
Public Function LoadTextFile(ByVal Url As String) As String
Dim wrq As WebRequest = WebRequest.Create(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq.GetResponse(), HttpWebResponse)
Dim sr As New StreamReader(wrp.GetResponseStream)
Dim Text As String = sr.ReadToEnd()
sr.Close()
wrp.Close()
Return Text
End Function
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #2

P: n/a
BRAVO Mr. Wagner!

It is refreshing to see a straightforward and correct answer as opposed to
the "why didn't you Google" responses that only waste bandwidth.

Well done.

Jim Hubbard
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e%****************@TK2MSFTNGP15.phx.gbl...
"eBob.com" <eB******@totallyfakeisp.com> schrieb:
I want to read a web page. That is, I have a URL and I want to read
the HTML and parse it and put the info into a data base. I've never
done any TCP/IP programming.


\\\
Imports System.IO
Imports System.Net
.
.
.
Public Function LoadTextFile(ByVal Url As String) As String
Dim wrq As WebRequest = WebRequest.Create(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq.GetResponse(), HttpWebResponse)
Dim sr As New StreamReader(wrp.GetResponseStream)
Dim Text As String = sr.ReadToEnd()
sr.Close()
wrp.Close()
Return Text
End Function
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #3

P: n/a
As the OP I hope that Mr. Wagner realized the difficulty of coming up with
search arguments for this query. I always do searches before posting a
question if I can come up with reasonable search arguments. But, in this
case, I did not have to do a search to realize that "read web page" was
going to get me a huge number of hits, only a handful of which would be of
interest.

Bob

"Jim Hubbard" <re***@groups.please> wrote in message
news:HJ******************@bignews5.bellsouth.net.. .
BRAVO Mr. Wagner!

It is refreshing to see a straightforward and correct answer as opposed to
the "why didn't you Google" responses that only waste bandwidth.

Well done.

Jim Hubbard
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e%****************@TK2MSFTNGP15.phx.gbl...
"eBob.com" <eB******@totallyfakeisp.com> schrieb:
I want to read a web page. That is, I have a URL and I want to read
the HTML and parse it and put the info into a data base. I've never
done any TCP/IP programming.


\\\
Imports System.IO
Imports System.Net
.
.
.
Public Function LoadTextFile(ByVal Url As String) As String
Dim wrq As WebRequest = WebRequest.Create(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq.GetResponse(), HttpWebResponse)
Dim sr As New StreamReader(wrp.GetResponseStream)
Dim Text As String = sr.ReadToEnd()
sr.Close()
wrp.Close()
Return Text
End Function
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


Nov 21 '05 #4

P: n/a
Although Google is promoted as the search engine King, I believe it is so
just because others have not tried Vivisimo yet.

Google is great at flooding you with a ton of results really fast. But,
sifting through all of those results to find something that meets your needs
can be time-consuming. It's like dumping a file folder full of related info
on the floor and having to look through the mess to find what you need.

Vivisimo groups results (they call it clustering - even have a beta site
called www.clusty.com the last time I looked) - try it and you'll see what I
mean.

Whenever I am overwhelmed by Google's info-glut, I go to www.Vivisimo.com to
sort things out.

(Note: No I do not work for or advertise on Vivisimo. I just think a great
solution deserves some air-time and people deserve choices.)

Jim Hubbard
"eBob.com" <eB******@totallybogus.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
As the OP I hope that Mr. Wagner realized the difficulty of coming up with
search arguments for this query. I always do searches before posting a
question if I can come up with reasonable search arguments. But, in this
case, I did not have to do a search to realize that "read web page" was
going to get me a huge number of hits, only a handful of which would be of
interest.

Bob

"Jim Hubbard" <re***@groups.please> wrote in message
news:HJ******************@bignews5.bellsouth.net.. .
BRAVO Mr. Wagner!

It is refreshing to see a straightforward and correct answer as opposed
to
the "why didn't you Google" responses that only waste bandwidth.

Well done.

Jim Hubbard
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e%****************@TK2MSFTNGP15.phx.gbl...
> "eBob.com" <eB******@totallyfakeisp.com> schrieb:
>> I want to read a web page. That is, I have a URL and I want to read
>> the HTML and parse it and put the info into a data base. I've never
>> done any TCP/IP programming.
>
> \\\
> Imports System.IO
> Imports System.Net
> .
> .
> .
> Public Function LoadTextFile(ByVal Url As String) As String
> Dim wrq As WebRequest = WebRequest.Create(Url)
> Dim wrp As HttpWebResponse = _
> DirectCast(wrq.GetResponse(), HttpWebResponse)
> Dim sr As New StreamReader(wrp.GetResponseStream)
> Dim Text As String = sr.ReadToEnd()
> sr.Close()
> wrp.Close()
> Return Text
> End Function
> ///
>
> --
> Herfried K. Wagner [MVP]
> <URL:http://dotnet.mvps.org/>
>
>



Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.