文件名称:联通短信通平台C#范例
文件大小:56KB
文件格式:DOC
更新时间:2015-09-10 09:13:40
联通短信C#
联通短信通平台C#范例 public static string GetDataToUrl(string strURL, string strData, string strEcode) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(strURL); HttpWebResponse response; Byte[] buffer = Encoding.GetEncoding(strEcode).GetBytes(strData); request.KeepAlive = true; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = buffer.Length; Stream respStream = request.GetRequestStream(); respStream.Write(buffer, 0, buffer.Length); respStream.Close(); response = (HttpWebResponse)request.GetResponse(); Stream myStream = response.GetResponseStream(); StreamReader sr = new StreamReader(myStream, Encoding.GetEncoding(strEcode)); String strContent = sr.ReadToEnd(); sr.Close(); return strContent; }