使用短信通/微米发短信

http://www.duanxin.cm/

    class Program
    {
        static string url = "http://180.97.163.89:8012/OpenPlatform/OpenApi";
        static void Main(string[] args)
        {
         
            var t = Task.Run(() => PostMessage());
            t.Wait();



        }

        public static async Task PostMessage()
        {
            var pairs = new List<KeyValuePair<string, string>>
                        {
                            new KeyValuePair<string, string>( "action", "sendOnce" ), 
                            new KeyValuePair<string, string>( "ac", "1001@" ), 
                            new KeyValuePair<string, string>( "authkey", "D5528AA2EEED774746754FF9CE36DA8D" ), 
                            new KeyValuePair<string, string>( "cgid", "6" ), 
                            new KeyValuePair<string, string> ( "c", "感谢您使用 爱考位 订单代报,您的订单号是:034421" ),
                            new KeyValuePair<string, string> ( "m", "13429329134" )
                        };
            var content = new FormUrlEncodedContent(pairs);
            using (var client = new HttpClient())
            {
                var response =
                    await client.PostAsync(url, content);
                string jsonMessage = await response.Content.ReadAsStringAsync();
            }

        }
    }

 http://www.weimi.cc/

string mobile = "<enter your mobiles>",
cid = "<enter your cid>",
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 + "&cid=" + cid + "&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();

 

posted @ 2016-03-30 09:20  nbu_djw  阅读(261)  评论(0编辑  收藏  举报