标签:
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方式的简易代码。
标签:
原文地址:http://www.cnblogs.com/shiratsuki/p/4420622.html