ASP.net ques: Webpage data retrieval and parsing

N

news.microsoft.com

Hi again, I am pretty new to ASP.net (I use to be a Visual Basic 6 addict)

I want to do the following but I have been unable to find good info/ or
sample code on it; please help;

- retrieve a webpage using ASP.net from another site (the url have
parameters like (domain.com/?date=january) in it if that makes a difference)

- using ASP.net code I want to Parse a table (perhaps using DomDocument
object?) I want to retrieve data from the table cell first by row and
then by column.
(retrieve the data to be store in data object)

- Then I want to use the data object to display the information retrieve in
webpage?


I am looking for sample codes, references or anything of that nature to help
me.
Thank you in advance. and please be as detail as you like.

Joe.
 
N

news.microsoft.com

I am looking for free tutorials, sample codes, references concerning my
questions.

I do hope ASP.net does have something free. Or else I might have to stick
with PHP. LOL
 
J

Joerg Jooss

news.microsoft.com said:
Hi again, I am pretty new to ASP.net (I use to be a Visual Basic 6
addict)

I want to do the following but I have been unable to find good info/
or sample code on it; please help;

- retrieve a webpage using ASP.net from another site (the url have
parameters like (domain.com/?date=january) in it if that makes a
difference)

Use System.Net.WebClient or System.Net.WebRequest.
- using ASP.net code I want to Parse a table (perhaps using
DomDocument object?) I want to retrieve data from the table cell
first by row and then by column.
(retrieve the data to be store in data object)

Use the HTML Agility Pack
(http://weblogs.asp.net/smourier/archive/2003/06/04/8265.aspx)


Cheers,
 
R

Rajesh Kumar

Hello,
Just follow the following..

1.
// Create the WebRequest for the URL eg www.domain.com/?date=january
WebRequest req = WebRequest.Create("www.domain.com/?date=january");

2.
// Get the stream from the returned web response
StreamReader stream = new
StreamReader(req.GetResponse().GetResponseStream());

3.
// Get the Source of teh html page.
string HtmlSource = stream.ReadToEnd();

Now you have all the source of the HTML page. Just use the regular
expression and search in the page.

Hope it can be of any use for you.

Regards,
Rajesh Kumar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top