Get Web Text
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.IO; namespace AutoLoL.Logic.Utils { public class Web { public static string GetWebText(string url) { return GetWebText(url, null); } public static string GetWebText(string url, string post) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); if (post != null) { ASCIIEncoding encoding = new ASCIIEncoding(); byte[] data = encoding.GetBytes(post); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(data, 0, data.Length); } } using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (Stream responseStream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(responseStream)) { return reader.ReadToEnd(); } } } } } }