weimi 短信API post方式的简易代码。

http://www.weimi.cc/example-csharp.html

string mobile = "<enter your mobiles>",
con = "【微米】您的验证码是:610912,3分钟内有效。如非您本人操作,可忽略本消息。",
uid = "<enter your UID>",
pas = "<enter your UID Pass>",
url = "http://api.weimi.cc/2/sms/send.html";
byte[] byteArray = Encoding.UTF8.GetBytes("mob=" + mobile + "&con=" + con + "&uid=" + uid + "&pas=" + pas + "&type=json");
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(url));
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = byteArray.Length;
Stream newStream = webRequest.GetRequestStream();
newStream.Write(byteArray, 0, byteArray.Length);
newStream.Close();
HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
StreamReader php = new StreamReader(response.GetResponseStream(), Encoding.Default);
string Message = php.ReadToEnd();
System.Console.Write(Message);
System.Console.Read();

  学习post方式的简易代码。

上一篇:[转]linux各文件夹介绍


下一篇:039 在weblogic下部署jndi的多数据源