C# - Getting Web Page Content from any website

By , 10/10/2012
(0 ratings)
This function will steal content from any URL
 HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://www.google.com");
                    myRequest.Method = "GET";
                    WebResponse myResponse = myRequest.GetResponse();
                    StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
                    string result = sr.ReadToEnd();
                    sr.Close();
                    myResponse.Close();
                    
                    Div1.InnerText = result;

Comments

 

Log in, to comment!