Click here to Skip to main content
13,052,669 members (66,282 online)
Rate this:
Please Sign up or sign in to vote.
See more:
please help

how to extract data with c#

how to extract first 10 page results from below website

thank you
Posted 30-Oct-12 5:11am
ryanb31 30-Oct-12 13:26pm
Start with something like

string downloadedString;
System.Net.WebClient client;

client = new System.Net.WebClient();

downloadedString = client.DownloadString("http://yoursite");
Sergey Alexandrovich Kryukov 30-Oct-12 15:42pm
Yes, this in some simplest cases. In more complex cases, HttpWebRequest is needed; and also some way to parse the HTML and drill it in.
I provided some more detailed answer, please see.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

What you need is called web scraping:[^].

You need to use either System.Net.WebClient (for simplest cases) or System.Net.HttpWebRequest with System.Net.WebResponse, in a general case. Please see:[^],[^],[^].

For a simple code sample, please see:[^].

See also my past answers to related questions:
How to get the data from another site[^],
get specific data from web page[^].

Maciej Los 30-Oct-12 16:47pm
Short and to the point, my 5!

I didn't knew it ;)
Sergey Alexandrovich Kryukov 30-Oct-12 18:37pm
Thank you, Maciej.
And now you know it! :-)
Member 9004602 30-Oct-12 19:58pm
dear sir
my requirement is
how to automate or click pages links 1, 2, 3, ........ 10
and get required data from above website
thank you
Member 9004602 30-Oct-12 20:02pm
dear sir

i try with downloadstring method and write to text file.
but i don't find required data (all search urls from page).
how to automate or click 1,2,3, ...... 10 pages links and extract required data.

thank you
Sergey Alexandrovich Kryukov 30-Oct-12 20:31pm
Well, this is the detail of how the page is organized. You will need to research it, perhaps starting with manual loading and lookup. They you will need to parse it. I've recommended the HTML parser, please see my links. And then, devise some mapping which will get you your links which you will download in the same way. You got all what's involved, now you need to actually do the job.
If you finally see how it makes sense, please accept the answer formally (green button) -- thanks.
Sushil Mate 30-Oct-12 23:44pm
web scraping?? even i didn't knew.. thanks for sharing :) +5
You are very welcome -- and thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 30 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100