Get Entire Markup For The Supplied URL.


/ Published in: C#
Save to your folder(s)

Returns the entire markup making up the specified webpage.


Copy this code and paste it in your HTML
  1. public string getHtml(string url)
  2. {
  3. HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
  4. myRequest.Method = "GET";
  5. WebResponse myResponse = myRequest.GetResponse();
  6. StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
  7. string result = sr.ReadToEnd();
  8. sr.Close();
  9. myResponse.Close();
  10. return result;
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.