473,884 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1283
"eBob.com" <eB******@total lyfakeisp.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(By Val Url As String) As String
Dim wrq As WebRequest = WebRequest.Crea te(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq. GetResponse(), HttpWebResponse )
Dim sr As New StreamReader(wr p.GetResponseSt ream)
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%******** ********@TK2MSF TNGP15.phx.gbl. ..
"eBob.com" <eB******@total lyfakeisp.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(By Val Url As String) As String
Dim wrq As WebRequest = WebRequest.Crea te(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq. GetResponse(), HttpWebResponse )
Dim sr As New StreamReader(wr p.GetResponseSt ream)
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.p lease> wrote in message
news:HJ******** **********@bign ews5.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%******** ********@TK2MSF TNGP15.phx.gbl. ..
"eBob.com" <eB******@total lyfakeisp.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(By Val Url As String) As String
Dim wrq As WebRequest = WebRequest.Crea te(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq. GetResponse(), HttpWebResponse )
Dim sr As New StreamReader(wr p.GetResponseSt ream)
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******@total lybogus.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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.p lease> wrote in message
news:HJ******** **********@bign ews5.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%******** ********@TK2MSF TNGP15.phx.gbl. ..
> "eBob.com" <eB******@total lyfakeisp.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(By Val Url As String) As String
> Dim wrq As WebRequest = WebRequest.Crea te(Url)
> Dim wrp As HttpWebResponse = _
> DirectCast(wrq. GetResponse(), HttpWebResponse )
> Dim sr As New StreamReader(wr p.GetResponseSt ream)
> 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
9040
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 arbitrary ascii files, to replace Yorick (which I use right now and which is really fast, but not as general as Python). The problem with scipy.io.read_array was, that it is really slow, returns errors when trying to process large files and it...
5
7757
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 until the word "explorer" then add it (+1) to my counter, then read next word, and so on. Example File:
2
1787
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 rendered w/ read/write text boxes and they can edit the various fields as needed. However, if the user doesn't have sufficient privileges (i.e. view only), the page is rendered w/ the text boxes set to read-only. However, this results in a rather...
4
4198
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 = (HttpWebRequest)WebRequest.Create("http://www.microsoft.com"); HttpWebResponse objResp = (HttpWebResponse)objRequ.GetResponse();
9
4279
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 read the value of redirect from the error statusCode 404. My web.config looks like this: <customErrors mode="RemoteOnly" defaultRedirect="Error.aspx"> <error statusCode="404" redirect="Error404.aspx" /> </customErrors>
0
9954
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10769
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10869
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10426
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7137
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4231
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3242
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.