473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How Can I Read a Web Page?

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
4 1261
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Sebastian Krause | last post by:
Hello, I tried to read in some large ascii files (200MB-2GB) in Python using scipy.io.read_array, but it did not work as I expected. The whole idea was to find a fast Python routine to read in...
5
by: Hareth | last post by:
How can I read lines from an XML file. & add them to a counter. If possible, words between <page> <\page> is considered as +1 to my counter. if it isnt possible, I would atlest like to read...
2
by: Julie | last post by:
I'm wondering what standard/best practices are for the following scenario: I have a page representing several fields for stored data. If the user has sufficient access privileges, the page is...
4
by: Kuldeep | last post by:
Hi All, I am trying to read the contents of a page through its URL. My code snippet is as follows: public void mtdGetPageDataHWR() { HttpWebRequest objRequ =...
9
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. Is it programatically possible in VB.NET to read the contents of web.config's <customErrorselement? I looked at using ConfigurationSettings.AppSettings, but that doesn't work. I need to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.