using System;<br>
using System.Web;<br>
using System.Net;<br>
using System.IO;<br>
using System.Text;<br>
namespace SendMessage<br>
{<br>
<br>
public bool SendMsg(MsgInfo msg)<br>
{<br>
//create request<br>
try<br>
{<br>
WebRequest req = WebRequest.Create("http://your_post_url");<br>
<br>
//set the request parameter <br>
req.Method = "POST";<br>
req.ContentType = "application/x-www-form-urlencoded";<br>
<br>
//querystring '?msg=xxx&type=0'<br>
string strQuery = "msg=";<br>
strQuery += HttpUtility.UrlEncode(msg);<br>
strQuery += "&type=0";<br>
<br>
string dataSend = strQuery;<br>
req.ContentLength = dataSend.Length;<br>
<br>
byte [] buff = Encoding.UTF8.GetBytes(dataSend); <br>
Stream reqStream = req.GetRequestStream();<br>
reqStream.Write(buff, 0, buff.Length);<br>
reqStream.Close();<br>
<br>
WebResponse rep = req.GetResponse();<br>
Stream repStream = rep.GetResponseStream();<br>
Encoding enc = Encoding.GetEncoding("utf-8");<br>
StreamReader sr = new StreamReader(repStream, enc);<br>
<br>
Char[] read = new C