Using system;using system.io;using system.net;using system.text;public class httputil{Private Const string Scontenttyp E = "application/x-www-form-urlencoded"; Private Const string suseragent = "mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2;. NET CLR 1.1.4322;. NET CLR 2.0.50727) "; public static string Send (string data, string url) {return Send (encoding.getencoding ("UTF-8"). GetBytes (data), URL); } public static string Send (byte[] data, string url) {Stream responsestream; HttpWebRequest request = webrequest.create (URL) as HttpWebRequest; if (request = = null) {throw new ApplicationException (string. Format ("Invalid URL string: {0}", url)); }//Request. useragent = suseragent; Request. ContentType = Scontenttype; Request. Method = "POST"; Request. ContentLength = data. Length; Stream requeststream = Request. GetRequestStream (); requestStream.Write (data, 0, data. Length); Requeststream.close (); try {responsestream = Request. GetResponse (). GetResponseStream (); } catch (Exception Exception) {throw Exception; } string str = string. Empty; using (StreamReader reader = new StreamReader (Responsestream, encoding.getencoding ("UTF-8"))) {str = RE Ader. ReadToEnd (); } responsestream.close (); return str; }}
C # Request HTTP Address