zoukankan      html  css  js  c++  java
  • 基于来信码的短信通知平台

    项目描述:

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

    功能描述:

      根据具体的业务需要开发程序,当需要提醒或者预警的情况发生时程序将被触发通过调用第三方短信平台的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 + "
    ";
    37             }
    38             return strValue;
    39         }
    40     }
    41 }
  • 相关阅读:
    net事件丢失解决方法
    Google排名经验谈
    动力漏洞
    Understand简明参考
    修复iReaper
    Bootstrap源码分析
    UTF8编码字节流错误小析
    OAuth2学习及DotNetOpenAuth部分源码研究
    DynamicModuleUtility对象在.net不同版本下的兼容性问题
    MediaWiKi简明安装与配置笔记
  • 原文地址:https://www.cnblogs.com/liusuqi/p/7992217.html
Copyright © 2011-2022 走看看