A Simple C# console Application

       PROGRAM TO GET DETAILS OF ANY WEBSITE HTML                                 TAGS AND JS TOO IN C#!


NOTE:
  • YOU NEED TO HAVE MICROSOFT VISUAL STUDIO (2010 OR NEWER VERSION) OR YOU CAN HAVE ANY PLATFORM WHICH SUPPORTS C# CONSOLE APPLICATION.

  • AFTER CREATING THE PROJECT, FIRST ADD THE LIBRARIES:
  1. Using System.Net;
  2. Using System.IO;

NOW,
  • WRITE THE FOLLOWING LINES IN MAIN METHOD:

static void Main(string[] args)
        {
            string url;
           Console.WriteLine("Enter any url to get details of its html and scripts:");
            url = Console.ReadLine();
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            StreamReader reader = new StreamReader(response.GetResponseStream());
            String html = reader.ReadToEnd();
            Console.Write(html);
            reader.Close();
            reader.Dispose();
            Console.Read();
        } 

NOW IT'S TIME TO RUN IT! THE OUTPUT IS GIVEN BELOW:



Comments

Contact Form

Name

Email *

Message *