How do I capture the text from the web page? Do I need to get the page source and how?
Asked
Active
Viewed 193 times
2
-
Does this answer your question? [How I can get web page's content and save it into the string variable](https://stackoverflow.com/questions/4510212/how-i-can-get-web-pages-content-and-save-it-into-the-string-variable) – Laurel Oct 28 '21 at 05:44
1 Answers
1
The WebClient
object has a method available to do this for you:
WebClient client = new WebClient();
string html = client.DownloadString("http://www.google.com");

George Johnston
- 31,652
- 27
- 127
- 172
-
The example above works only in older versions, not my Visual Studio 2008. The correct code is: #using
using namespace System::Net; using namespace System::IO; using namespace System; ... void main(){ WebClient^ client = gcnew WebClient; CString html = client->DownloadString(_T("http://www.google.bg/")); } – Trepach Aug 03 '11 at 15:02