旅游行业怎么利用C#接口发送短信

旅游企业一般拥有众多的分支机构,同时各地分支机构又有众多下属分散在当地各区的旅游营业报名点,以前传统的解决方案是采用专线、MODEM拔号等方式,专线的成本很高,MODEM拔号更费时,且长途拔号互联成本在多点情况下费用也不低。相反的是,群发短信业务不仅费用低,且效率好。

 支持免费试用乐讯通PaaS平台 找好用的短信平台,选择乐讯通,短信群发|短信平台|群发短信软件|群发短信平台|乐讯通PaaS平台icon-default.png?t=N7T8http://yun.loktong.com/login/register/0c61bafb77

 

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace WinApiDemo
{class Program{private const string url = "http://www.lokapi.cn/smsUTF8.aspx";private const string urlReply = "http://www.lokapi.cn/callApi.aspx";private const string urlStatus = "http://www.lokapi.cn/statusApi.aspx";private const string urlBalance = "http://www.lokapi.cn/smsUTF8.aspx";private const string urlKeyword = "http://www.lokapi.cn/checkWord.aspx";private const string rece = "json";private const string username = "";private const string password = "";private const string encode = "utf-8";//tokenprivate const string tokenYZM = "";//验证码private const string tokenTZ = "";//通知private const string tokenYX = "";//营销private const string tokenMMS = "";//彩信private const string tokenVideo = "";//视频private const string tokenSX = "";//闪信private const string tokenVoice = "";//语音private const string tokenInter = "";//国际//模板IDprivate const string templateid = "";//参数private const string param = "17733861234|2541";private const string mobile = "";private const string title = "祝福短信";//彩信标题static void Main(string[] args){string result = "";string sign = "";string passwordMd5 = Common.Md5Hash(password);string ticks = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000).ToString();Encoding encoding = Encoding.GetEncoding(encode);StringBuilder sb = new StringBuilder();#region 文字短信sb.AppendFormat("action=sendtemplate&username={0}&password={1}&token={2}&timestamp={3}", username, passwordMd5, tokenYZM, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);sb.AppendFormat("&templateid={0}&param={1}", templateid, param);result = Common.HttpPost(url, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 彩信sb.Clear();sb.AppendFormat("action=sendimagetext&username={0}&password={1}&token={2}&timestamp={3}", username, passwordMd5, tokenYZM, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);sb.AppendFormat("&mobile={0}&title={1}", mobile, title);//彩信发送主体//文字string content = "祝你生日快乐";Encoding encodingGB = Encoding.GetEncoding("gb2312");byte[] txt_bytes = encoding.GetBytes(content);string txt = Convert.ToBase64String(txt_bytes);//图片string path = @"D:\我的文档\Pictures\11.jpg";string extension = "jpg";//图片后缀byte[] bytes = File.ReadAllBytes(path);string imgContent = System.Convert.ToBase64String(bytes);string message = string.Format("txt|{0},{1}|{2};", txt, extension, imgContent);message = message.Replace("%", "%25");message = message.Replace("&", "%26");message = message.Replace("+", "%2B");sb.AppendFormat("&message={0}", message);result = Common.HttpPost(url, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 视频sb.Clear();sb.AppendFormat("action=sendvideo&username={0}&password={1}&token={2}&timestamp={3}", username, passwordMd5, tokenYZM, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);sb.AppendFormat("&mobile={0}&templateid={1}", mobile, templateid);result = Common.HttpPost(url, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 闪信sb.Clear();sb.AppendFormat("action=sendshanxin&username={0}&password={1}&token={2}&timestamp={3}", username, passwordMd5, tokenYZM, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);sb.AppendFormat("&templateid={0}&param={1}", templateid, param);result = Common.HttpPost(url, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 语音sb.Clear();sb.AppendFormat("action=sendvoice&username={0}&password={1}&token={2}&timestamp={3}", username, passwordMd5, tokenYZM, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);sb.AppendFormat("&templateid={0}&param={1}", templateid, param);result = Common.HttpPost(url, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 国际sb.Clear();sb.AppendFormat("action=sendinternation&username={0}&password={1}&token={2}&timestamp={3}", username, passwordMd5, tokenYZM, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);sb.AppendFormat("&templateid={0}&param={1}", templateid, param);result = Common.HttpPost(url, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 文字回复报告sb.Clear();sb.AppendFormat("action=sms&username={0}&password={1}&timestamp={2}", username, passwordMd5, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);result = Common.HttpPost(urlReply, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 状态报告sb.Clear();//action根据API文档选择合适产品的actionsb.AppendFormat("action=sms&username={0}&password={1}&timestamp={2}", username, passwordMd5, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);result = Common.HttpPost(urlStatus, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 余额查询sb.Clear();sb.AppendFormat("action=overage&username={0}&password={1}&token={2}&timestamp={3}", username, passwordMd5, tokenTZ, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}", sign, rece);result = Common.HttpPost(urlBalance, sb.ToString(), encoding);Console.WriteLine(result);#endregion#region 屏蔽词检测sb.Clear();sb.AppendFormat("username={0}&password={1}&timestamp={2}", username, passwordMd5, ticks);sign = Common.Md5Hash(sb.ToString());sb.AppendFormat("&sign={0}&rece={1}&message={2}", sign, rece, "您的验证码是5412");result = Common.HttpPost(urlKeyword, sb.ToString(), encoding);Console.WriteLine(result);#endregionConsole.ReadKey();}}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;namespace WinApiDemo
{public class Common{public static string HttpPost(string Url, string Body, Encoding encode){string ResponseContent = "";try{HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(Url);httpWebRequest.ContentType = "application/x-www-form-urlencoded";httpWebRequest.Method = "POST";httpWebRequest.Timeout = 600000; //setInstanceFollowRedirectsbyte[] btBodys = encode.GetBytes(Body);httpWebRequest.ContentLength = btBodys.Length;Stream reqStream = httpWebRequest.GetRequestStream();reqStream.Write(btBodys, 0, btBodys.Length);HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();Stream resStream = httpWebResponse.GetResponseStream();StreamReader streamReader = new StreamReader(resStream, encode);ResponseContent = streamReader.ReadToEnd();streamReader.Close();resStream.Close();reqStream.Close();streamReader.Dispose();resStream.Dispose();reqStream.Dispose();httpWebResponse.Close();httpWebResponse.Dispose();httpWebRequest.Abort();}catch (Exception ex){return ex.ToString();}return ResponseContent;}public static string Md5Hash(string input){MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));StringBuilder sBuilder = new StringBuilder();for (int i = 0; i < data.Length; i++){sBuilder.Append(data[i].ToString("x2"));}return sBuilder.ToString().ToUpper();}}
}

 

服务信息:发布旅游信息,吸引客户,这种方式费用低,效率好。景区宣传:可对旅游景区(点)或旅游公司新推出的旅游路线进行描述,通过短信发送到潜在顾客的手机上,实现对旅游产品及服务的跨区域、跨时空宣传。

订房/订票公司、旅行社可以通过短信通向客户发送消费积分、节日祝福、生日祝贺等,实现低成本有效的客户管理,加强客情沟通、提高客户满意度,提高营业收入。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/878223.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

企业数据治理之主数据---供应商主数据

一、供应商主数据的定义 供应商是向企业或个人提供商品、服务或资源的个人、公司或其他实体。一般企业内部的供应商有多种&#xff0c;有零部件采购供应商、材料采购供应商、设备采购供应商、外协生产供应商等&#xff0c;而且这些供应商在企业内部有可能有不同的部门负责&…

微前端集成优化:让所有子应用体积更小,加载更快!

简介 随着前端的日益发展&#xff0c;微前端架构越来越受到青睐。它通过将前端应用拆分为多个独立的子应用&#xff0c;每个子应用可以独立开发、部署和运行&#xff0c;从而提升了开发效率和团队协作。目前主流的微前端方案应该是qiankun了。 以笔者公司为例&#xff0c;采用…

基于SpringBoot的在线答疑系统

你好呀&#xff0c;我是计算机专业毕业生&#xff0c;专注于在线教育平台的开发与实现。 开发语言&#xff1a;Java 数据库&#xff1a;MySQL 技术&#xff1a;Java技术 Spring Boot框架 工具&#xff1a;IntelliJ IDEA、Navicat、Maven、Tomcat 系统展示 首页 个人中心…

【C#】【EXCEL】Bumblebee/Components/Analysis/GH_Ex_Ana_CondAverage.cs

Bumblebee/Components/Analysis/GH_Ex_Ana_CondAverage.cs 这段代码定义了一个名为 GH_Ex_Ana_CondAverage 的类&#xff0c;它是一个 Grasshopper 组件。这个组件的主要功能是为 Excel 工作表中的一个范围添加基于平均值的’条件格式’。以下是对这个组件的功能和特点的详细介…

FFmpeg源码:read_packet_wrapper、fill_buffer函数分析

AVIOContext结构体和其相关的函数分析&#xff1a; FFmpeg源码&#xff1a;avio_r8、avio_rl16、avio_rl24、avio_rl32、avio_rl64函数分析 FFmpeg源码&#xff1a;read_packet_wrapper、fill_buffer函数分析 FFmpeg源码&#xff1a;avio_read函数分析 FFmpeg源码&#xff…

scrapy--图片管道-ImagesPipeline

免责声明:本文仅做演示与分享~ 目录 介绍 ImagesPipeline pipelines.py items.py zz.py settings.py 介绍 scrapy 还提供了处理图片、视频、音频等媒体文件的插件&#xff0c;如&#xff1a; - scrapy-images&#xff1a;用于下载和处理图片 - scrapy-video&#xff1…

责任链设计模式详解

责任链设计模式详解 一、定义 责任链设计模式&#xff08;Chain of Responsibility Pattern&#xff09;是一种行为设计模式&#xff0c;它允许多个对象有机会处理请求&#xff0c;从而避免请求的发送者和接收者之间的耦合。这种模式将这些对象连接成一条链&#xff0c;并沿着…

提前还房贷结果失败了该怎么办?需要注意哪些?怎么做更顺利?

提前还房贷结果失败了&#xff0c;该怎么办&#xff1f; 1. 满足条件再申请&#xff1a;部分银行对提前还款设有一定的条件和限制&#xff0c;例如需要提前预约&#xff0c;对已还款时间和还款金额也有具体的要求。如果借款人未能满足这些条件&#xff0c;提前还款的申请可能会…

【精选】计算机毕业设计之:基于springboot超市进销存系统

博主介绍&#xff1a; ✌我是阿龙&#xff0c;一名专注于Java技术领域的程序员&#xff0c;全网拥有10W粉丝。作为CSDN特邀作者、博客专家、新星计划导师&#xff0c;我在计算机毕业设计开发方面积累了丰富的经验。同时&#xff0c;我也是掘金、华为云、阿里云、InfoQ等平台…

Stable Diffusion AI绘画工具的安装与配置(MAC用户)

AI绘画的热潮席卷了整个创意行业&#xff0c;Stable Diffusion作为其中的翘楚&#xff0c;让艺术创作变得前所未有的简单。然而&#xff0c;对于使用Mac电脑用户来说&#xff0c;安装和配置Stable Diffusion可能显得有些棘手。别担心&#xff0c;这份详细的教程将手把手教你如何…

【Material-UI】Select 组件中的 `Auto width`、`Small Size` 和 `Other Props` 详解

文章目录 一、Select 组件概述1. 组件介绍2. Select 组件的基本结构 二、Auto width 属性详解1. Auto width 的作用2. Auto width 属性的基本用法3. Auto width 的实际应用场景 三、Small Size 属性详解1. Small Size 的作用2. Small Size 属性的基本用法3. Small Size 的实际应…

pytorch 数据处理

torch工具类Dataset和DataLoader 对于NN模型训练来说&#xff0c;需要将数据转换成torch识别的数据类型&#xff0c;才能喂给模型。pytorch中&#xff0c;通常使用Dataset和DataLoader这两个工具类来构建数据管道。 Dataset定义了数据集的内容&#xff0c;类似一个列表的数据…

Windows怎么让防火墙开放端口

开放端口的方法 先从控制面板,进入到Windows Defender防火墙 点击高级设置,点击入站规则 点击右边的新建规则,点击端口,点击下一步 选择协议类型和端口号点击下一步即可 查看是否开放端口成功的方法: 进入任务管

【rk3588】环境搭建及系统编译

开发板&#xff1a;ROC-RK3588S-PC 官方链接&#xff1a;Welcome to ROC-RK3588S-PC Manual — Firefly Wiki (t-firefly.com) 串口调试配置 一、产品介绍 — Firefly Wiki (t-firefly.com)&#xff0c;可以按照官方链接的说明在个人PC上使用串口。这个串口会输出rk3588的日…

【Python机器学习】NLP词频背后的含义——从词频到主题得分

目录 TF-IDF向量及词形归并 主题向量 一个思想实验 一个主题评分算法 一个LDA分类器 LDiA TF-IDF向量&#xff08;词项频率—逆文档频率向量&#xff09;可以帮助我们估算词在文本块中的重要度&#xff0c;我们使用TF-IDF向量和矩阵可以表明每个词对于文档集合中的一小段…

WHAT - 通过 react-use 源码学习 React(Side-effects 篇)

目录 一、官方介绍1. Sensors2. UI3. Animations4. Side-Effects5. Lifecycles6. State7. Miscellaneous 二、源码学习示例&#xff1a;n. xx - yySide-effects - useAsync, useAsyncFn, and useAsyncRetryuseAsyncuseAsyncFnuseAsyncRetry 一、官方介绍 Github 地址 react-u…

在vue3中封装WebSocket

下载websocket npm install websocket 或 yarn add websocket 一、新建webSockte.js文件 // webSocket.js // 自定义组合式函数&#xff0c;用于管理 WebSocket 连接 import { ref, onMounted, onBeforeUnmount } from "vue"; const useWebSocket (url, reco…

【日常记录-Linux】unzip指令

Author&#xff1a;赵志乾 Date&#xff1a;2024-08-28 Declaration&#xff1a;All Right Reserved&#xff01;&#xff01;&#xff01; 1. 简介 unzip是一个在类Unix系统(如Linux、macOS)上广泛使用的命令行工具&#xff0c;用于解压缩.zip格式的文件。.zip是一种广泛支持…

离线环境玩转 Tauri

离线环境玩转 Tauri 1. Tauri 是什么 Tauri 是一个用于构建跨平台桌面应用程序的框架&#xff0c;它允许开发者使用前端技术&#xff08;如 React、Vue、Svelte 等&#xff09;来构建桌面应用程序&#xff0c;同时提供高性能和低资源消耗的特性。 Tauri 的核心思想是使用前端…

令牌和签名详细介绍+开发使用教程

令牌和签名简介 1. 令牌&#xff08;Token&#xff09; 概念 令牌&#xff08;Token&#xff09;是一个用于身份验证的小段数据&#xff0c;通常在用户登录时由服务器生成&#xff0c;并返回给客户端。客户端在后续的请求中将令牌附加到请求头中&#xff0c;服务器通过验证令…