基于来信码的短信通知平台

项目描述:

  在企业日常运营中总有一些需要定期提醒或者异常情况预警的需求,为此我们需要做一个短信通知平台。

功能描述:

  根据具体的业务需要开发程序,当需要提醒或者预警的情况发生时程序将被触发通过调用第三方短信平台的API来发送相关消息给相关人员。

来信码短信平台API调用代码示例:

 1 namespace ShortMsg
 2 {
 3     public class BechSms
 4     {
 5         public static readonly string Url = "http://imlaixin.cn/Api/send/data/json";
 6         public string Accesskey { get; set; }
 7         public string Secretkey { get; set; }
 8 
 9         public BechSms(string access, string secret)
10         {
11             this.Accesskey = access;
12             this.Secretkey = secret;
13         }
14 
15         public string Send(string mobile, string msg)
16         {
17             string param = "accesskey=" + this.Accesskey + "&secretkey=" + this.Secretkey + "&mobile=" + mobile + "&content=" + msg;
18             return Request(BechSms.Url, param);
19         }
20 
21         private string Request(string url, string param)
22         {
23             string strURL = url + '?' + param;
24             System.Net.HttpWebRequest request;
25             request = (System.Net.HttpWebRequest)WebRequest.Create(strURL);
26             request.Method = "GET";
27             System.Net.HttpWebResponse response;
28             response = (System.Net.HttpWebResponse)request.GetResponse();
29             System.IO.Stream s;
30             s = response.GetResponseStream();
31             string StrDate = "";
32             string strValue = "";
33             StreamReader Reader = new StreamReader(s, Encoding.UTF8);
34             while ((StrDate = Reader.ReadLine()) != null)
35             {
36                 strValue += StrDate + "\r\n";
37             }
38             return strValue;
39         }
40     }
41 }

 

转载于:https://www.cnblogs.com/liusuqi/p/7992217.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值