|
xxx
NET Classes/HTTP Scraping by Charles Carroll
This page demonstrates how to read another website using the NGWS NET classes. They are much richer than this example indicates (proxy, authentication,
https just works, everything a developer needs), fully thread-safe, and can do both high and low-level socket tasks.
You will find some useful starting examples at:
http://msdn.microsoft.com/library/techart/PDC_websvc.htm
You should also check out
Now for our first code sample we will read in the string data resulting from the URL for a site called FunInSpace.com.
filename=\\experiments\\scraping\\scrapingv3.aspx
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Try
Dim objResponse As System.Net.WebResponse
Dim objRequest As System.Net.WebRequest
DIM theurlresult as string
DIM theurl as string = "http://www.cnn.com"
objRequest = System.Net.HttpWebRequest.Create(theurl)
objResponse = objRequest.GetResponse()
Dim sr As new system.io.StreamReader(objResponse.GetResponseStream())
theURLresult=server.HTMLencode(sr.ReadToEnd())
Page.Controls.Add(new LiteralControl(theURLresult))
Catch ex As Exception
Page.Controls.Add(new LiteralControl(ex.Message))
End Try
End Sub
</script>
<html><head>
<title>Scraping A Website</title>
</head>
<body bgcolor="#FFFFFF">
<h3><font face="Verdana">Scraped Data</font></h3>
</body></html>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|