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 }
  • 相关阅读:
    Codeforces 787D. Legacy 线段树优化建图+最短路
    Codeforces 1051E. Vasya and Big Integers
    BZOJ3261 最大异或和
    BZOJ3531 SDOI2014 旅行
    洛谷P2468 SDOI 2010 粟粟的书架
    2018 ICPC 焦作网络赛 E.Jiu Yuan Wants to Eat
    HDU6280 From Tree to Graph
    HDU5985 Lucky Coins 概率dp
    (HDU)1334 -- Perfect Cubes (完美立方)
    (HDU)1330 -- Deck (覆盖物)
  • 原文地址:https://www.cnblogs.com/liusuqi/p/7992217.html
Copyright © 2011-2022 走看看