Okay so I have been trying to open web pages and copy all the text from it and write it to a text file.
I have got the writing to text file bit, but I want to know if it is possible to copy all the text from a web page into a variable.
If it is possible is it quite difficult or relatively simple? If simple could you please give me an idea about how I would go about achieving this.
If it is any help, I am opening the web page by the following code:
Process proc = new Process();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.FileName = "";
proc.Start();
Amaan MerchantPosted Jan 21, 2012, 6:15 AM
And yes, it's data in a web page in a website. Also the program is a simple console one.
Any help would be appreciated.
Sam HobbsPosted Jan 21, 2012, 5:09 AM
The sample code you show does not help me to understand what data you are processing. Is the data a web page in a web site someplace or is it a document in your local computer? If you can be more specific about what the data is in terms of where you rea getting it from then that will help.
Also, do you need all the text from the web site or do you only peices? You can use something called the DOM to get pecies of a web page, but that can get complicated. Some people use regular expressions but that is something that looks easy at the beginning but then it can get quickly get too complicated.
Also note that some web sites provide a way to get data from them that is easier than other ways. So if the web site is one that has web services or something like that then you should learn about that.