winFrom http协议
public static string GetStringByUrl(string url) { HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; HttpWebResponse webResponse = request.GetResponse() as HttpWebResponse; using (Stream s = webResponse.GetResponseStream()) { StreamReader reader = new StreamReader(s, Encoding.UTF8); return reader.ReadToEnd(); } }
var result = GetStringByUrl(textBox1.Text.Trim());