首页 > Windows开发 > 详细

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

时间:2015-04-12 22:34:38      阅读:293      评论:0      收藏:0      [点我收藏+]

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方式的简易代码。

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

原文:http://www.cnblogs.com/shiratsuki/p/4420622.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!