标签:
public string Query(string queryString) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestURL); request.Method = "POST"; UTF8Encoding encoding = new UTF8Encoding(); byte[] byteArray = encoding.GetBytes(queryString); request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = byteArray.Length; Stream requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); WebResponse response = request.GetResponse(); Stream responseStream = response.GetResponseStream(); StreamReader sr = new StreamReader(responseStream); string result = sr.ReadToEnd(); requestStream.Close(); sr.Close(); responseStream.Close(); return result; }
标签:
原文地址:http://www.cnblogs.com/sherlock99/p/4282347.html