1

I have read in the information but I cant seem to figure out how to get the information I want ie the name, type etc into a table. here what I did to get the data. ( I used a try-catch)

        string url = ("http://www.oiseaux-birds.com/card-laughing-dove.html");
        WebResponse response = null;
        StreamReader reader = null;

        try
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "GET";
            response = request.GetResponse();
            reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
            result = reader.ReadToEnd();
           
        }
       
        finally
        {
            if (reader != null)
                reader.Close();
            if (response != null)
                response.Close();
            Console.WriteLine(result);
           }
sazzy
  • 11
  • 2
  • Sorry, I am new to coding can you please explain? the catch part was : catch (Exception ex) { Console.WriteLine(ex.Message); } I forgot to add it in the question sorry. if it makes any difference – sazzy Feb 02 '21 at 11:44
  • If you can get the html then that is a start. Now think about how to get what you want from the response: https://stackoverflow.com/questions/56107/what-is-the-best-way-to-parse-html-in-c – mikelegg Feb 02 '21 at 11:47
  • This is answered [here](https://stackoverflow.com/questions/2038104/parsing-html-to-get-content-using-c-sharp), how to parse html in c#. – Sulabh Agarwal Feb 02 '21 at 11:54
  • You can edit your question to add catch part. – AntiqTech Feb 02 '21 at 14:03

0 Answers0