Get access to elements and event form of web-page from program C, C#, C++ etc | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Get access to elements and event form of web-page from program C, C#, C++ etc

Hi dear friends. Please give information advice , about libraries and functions to let implement question. I want to write a little code to automatically upgrade information from database on site.

4th May 2019, 11:03 AM
vitalii
vitalii - avatar
1 Answer
+ 1
In c# you can read data from webpages by HttpWebRequest. See code below: string html = string.Empty; string url = @"https://www.sololearn.com"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.AutomaticDecompression = DecompressionMethods.GZip; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) { html = reader.ReadToEnd(); } Console.WriteLine(html);
12th May 2019, 1:07 PM
Thomas Wittek
Thomas Wittek - avatar