public static string PostUrl = "http://zapi.253.com/msg/HttpBatchSendSM";
static void Main(string[] args)
{
string account = "";
string password = "";
string mobile = "";
string content = "您的登陆验证码是1234"; string postStrTpl = "account={0}&pswd={1}&mobile={2}&msg={3}&needstatus=true&product=&extno="; UTF8Encoding encoding = new UTF8Encoding();
byte[] postData = encoding.GetBytes(string.Format(postStrTpl, account, password, mobile, content)); HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(PostUrl);
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = postData.Length; Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(postData, , postData.Length);
newStream.Flush();
newStream.Close(); HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); if (myResponse.StatusCode == HttpStatusCode.OK)
{
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
myResponse.Close();
myRequest.Abort();
Console.WriteLine("发送成功");
Console.ReadKey();
}
else
{
myRequest.Abort();
myResponse.Close();
Console.WriteLine("发送失败");
Console.ReadKey();
}
}

创蓝语音服务.net(返回错误的情况)

  public static string PostUrl = "http://zapi.253.com/msg/HttpBatchSendSM";
static void Main(string[] args)
{
string account = "V0240532111";
string password = "pE3e8r60wM01c5111";
string mobile = "";
string content = "您的登陆验证码是1234";
string postStrTpl = "account={0}&pswd={1}&mobile={2}&msg={3}&needstatus=true&product=&extno="; UTF8Encoding encoding = new UTF8Encoding();
byte[] postData = encoding.GetBytes(string.Format(postStrTpl, account, password, mobile, content));
string resultCode = "";
HttpWebRequest myRequest = null;
HttpWebResponse myResponse = null;
try
{
myRequest = (HttpWebRequest)WebRequest.Create(PostUrl);
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = postData.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(postData, , postData.Length);
newStream.Flush();
newStream.Close(); myResponse = (HttpWebResponse)myRequest.GetResponse(); if (myResponse.StatusCode == HttpStatusCode.OK)
{
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
string result = reader.ReadToEnd(); if (result != null)
{
string[] arr = result.Split(',');
resultCode = arr[];
}
}
}catch(Exception ex)
{
Console.Write(ex);
}
finally
{
if (myRequest != null)
{
myRequest.Abort();
}
if (myResponse != null)
{
myResponse.Close();
}
}
if (resultCode.StartsWith(""))
{
Console.WriteLine("发送成功");
Console.ReadKey();
}
else
{
Console.WriteLine("发送失败" + resultCode);
Console.ReadKey();
}
}

创蓝语音服务(语音通知验证码).net的更多相关文章

  1. C# 开发(创蓝253)手机短信验证码接口

    创蓝253: https://www.253.com/ #region 获取手机验证码(创蓝253) /// <summary> /// 获取手机验证码(创蓝253) /// </s ...

  2. python3调用阿里云语音服务

    步骤 1 创建阿里云账号,包括语音服务里的企业实名 为了访问语音服务,您需要有一个阿里云账号.如果没有,可首先按照如下步骤创建阿里云账号: 访问阿里云 官方网站,单击页面上的 免费注册 按钮. 按照屏 ...

  3. 3D语音天气球(源码分享)——在Unity中使用Android语音服务

    转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! 开篇废话: 这个项目准备分四部分介绍: 一:创建可旋转的"3D球":3 ...

  4. java接入创蓝253短信验证码

    说明 项目是springboot框架 1.短信配置文件 包含验证码发送路径.用户名.密码 chuanglan.requesturl= chuanglan.account= chuanglan.pswd ...

  5. Java如何调取创蓝253短信验证码

    基于创蓝253短信服务平台的Java调用短信接口API package com.bcloud.msg.http; import java.io.ByteArrayOutputStream; impor ...

  6. 【认知服务 Azure Cognitive Service】使用认知服务的密钥无法访问语音服务[ErrorCode=AuthenticationFailure] (2020-08时的遇见的问题,2020-09月已解决)

    问题情形 根据微软认知服务的文档介绍,创建认知服务(Cognitive Service)后,可以调用微软的影像(计算机视觉,人脸),语言(LUIS, 文本分析,文本翻译),语音(文本转语音,语音转文本 ...

  7. Android讯飞语音云语音听写学习

    讯飞语音云语音听写学习         这几天两个舍友都买了iPhone 6S,玩起了"Hey, Siri",我依旧对我的Nexus 5喊着"OK,Google" ...

  8. UI进阶 科大讯飞(1) 语音听写(语音转换成文字)

    一.科大讯飞开放平台: http://www.xfyun.cn/ 注册.登录之后创建新应用. 因为本项目只实现了语音听写,所以在SDK下载中心勾选语音听写单项SDK就可以了 开发平台选择iOS,应用选 ...

  9. 2019 创蓝253java面试笔试题 (含面试题解析)

      本人5年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.创蓝253等公司offer,岗位是Java后端开发,因为发展原因最终选择去了创蓝253,入职一年时间了,也成为 ...

随机推荐

  1. AIX上安装配置DB2

    在2台P550数据库主机上安装DB2 V8.2,两台数据库主机间进行数据库HA配置,实现数据库双机互备. 本文档编写以磁盘大小360G,数据库名CRAMS_JS为例. 设备准备 请系统管理员协助划分D ...

  2. day3——关于<s:if/>和文件上传

    一个小的注意点 <s:if test='#backyear==#yearatd'>selected="selected"</s:if> <s:if t ...

  3. vue中的minix

    minix 是个什么东西, 就是混合,把你混合给我 浅显表述就是 你说 : ‘我叫李四’, 我说 : ‘我叫张三’, 然后把你 混合给我, 就成了 我说 : ‘我叫张三我叫李四’, 所有解说都在例子里 ...

  4. python编码与存储读取数据(数组字典)

    Camp时在python2的编码上坑了不少. 理解pyhon2的编码 python2字符串类型只有两种: str类型:b'xxx'即是str类型, 是编码后的类型,len()按字节计算 unicode ...

  5. 【BZOJ1304】[CQOI2009]叶子的染色(动态规划)

    [BZOJ1304][CQOI2009]叶子的染色(动态规划) 题面 BZOJ 洛谷 题解 很简单. 设\(f[i][0/1/2]\)表示以\(i\)为根的子树中,还有颜色为\(0/1/2\)(\(2 ...

  6. 【转】Git 安装和使用教程

    git 提交 全部文件 git add .  git add xx命令可以将xx文件添加到暂存区,如果有很多改动可以通过 git add -A .来一次添加所有改变的文件.注意 -A 选项后面还有一个 ...

  7. JavaScript学习复习

    JavaScript 输出 使用 window.alert() 弹出警告框. 使用 document.write() 方法将内容写到 HTML 文档中. 使用 innerHTML 写入到 HTML 元 ...

  8. CodeSmith自己动手写模板

    CodeSmith学习笔记------ 1.新建一个Code Smith Generator Template(C sharp) 2.一些常见标签的解释: ①外部变量: <%@ Property ...

  9. 【CF437C】The Child and Toy

    题目大意:给定一个有 N 个点,M 条边的无向图,点有点权,删除一个点就要付出所有与之有联系且没有被删除的点的点权之和的代价,求将所有点删除的最小代价是多少. 题解:从图连通性的角度出发,删除所有点就 ...

  10. Activiti学习之 多实例实现会签功

    转: Activiti学习之 多实例实现会签功能 2014年11月26日 11:27:11 程诺 阅读数:26185   版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog ...