创蓝语音服务(语音通知验证码).net
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的更多相关文章
- C# 开发(创蓝253)手机短信验证码接口
创蓝253: https://www.253.com/ #region 获取手机验证码(创蓝253) /// <summary> /// 获取手机验证码(创蓝253) /// </s ...
- python3调用阿里云语音服务
步骤 1 创建阿里云账号,包括语音服务里的企业实名 为了访问语音服务,您需要有一个阿里云账号.如果没有,可首先按照如下步骤创建阿里云账号: 访问阿里云 官方网站,单击页面上的 免费注册 按钮. 按照屏 ...
- 3D语音天气球(源码分享)——在Unity中使用Android语音服务
转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! 开篇废话: 这个项目准备分四部分介绍: 一:创建可旋转的"3D球":3 ...
- java接入创蓝253短信验证码
说明 项目是springboot框架 1.短信配置文件 包含验证码发送路径.用户名.密码 chuanglan.requesturl= chuanglan.account= chuanglan.pswd ...
- Java如何调取创蓝253短信验证码
基于创蓝253短信服务平台的Java调用短信接口API package com.bcloud.msg.http; import java.io.ByteArrayOutputStream; impor ...
- 【认知服务 Azure Cognitive Service】使用认知服务的密钥无法访问语音服务[ErrorCode=AuthenticationFailure] (2020-08时的遇见的问题,2020-09月已解决)
问题情形 根据微软认知服务的文档介绍,创建认知服务(Cognitive Service)后,可以调用微软的影像(计算机视觉,人脸),语言(LUIS, 文本分析,文本翻译),语音(文本转语音,语音转文本 ...
- Android讯飞语音云语音听写学习
讯飞语音云语音听写学习 这几天两个舍友都买了iPhone 6S,玩起了"Hey, Siri",我依旧对我的Nexus 5喊着"OK,Google" ...
- UI进阶 科大讯飞(1) 语音听写(语音转换成文字)
一.科大讯飞开放平台: http://www.xfyun.cn/ 注册.登录之后创建新应用. 因为本项目只实现了语音听写,所以在SDK下载中心勾选语音听写单项SDK就可以了 开发平台选择iOS,应用选 ...
- 2019 创蓝253java面试笔试题 (含面试题解析)
本人5年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.创蓝253等公司offer,岗位是Java后端开发,因为发展原因最终选择去了创蓝253,入职一年时间了,也成为 ...
随机推荐
- SDN网路虚拟化平台概述
SDN网络虚拟化平台是介于物理网络拓扑以及控制器之间的中间层.虚拟化平台主要是完成物理网络拓扑到虚拟网络资源的映射,管理物理网络,并向租户提供相互隔离的虚拟网络. 为了实现网络虚拟化,虚拟化平台首先需 ...
- Java编写准备数据源
1.装饰设计模式 package com.itheima.ds; import java.sql.Array; import java.sql.Blob; import java.sql.Callab ...
- ElasticSearch 2 (32) - 信息聚合系列之范围限定
ElasticSearch 2 (32) - 信息聚合系列之范围限定 摘要 到目前为止我们看到的所有聚合的例子都省略了搜索请求,完整的请求就是聚合本身. 聚合与搜索请求同时执行,但是我们需要理解一个新 ...
- [2017BUAA软工]结对项目-数独程序扩展
零.github地址 GitHub地址:https://github.com/Liu-SD/SudoCmd (这个地址是命令行模式数独的仓库,包含了用作测试的BIN.DLL核心计算模块地址是:http ...
- Linux命令(二) 复制文件 cp
cp命令用来复制文件或目录,当复制多个文件时,目标文件参数必须为已经存在的目录,否则将出现错误. cp命令默认不能复制目录,复制目录必须使用 -R 选项.cp命令具备了 ln命令的功能. 命令格式: ...
- Oracle client 使用 .net程序连接 数据库时 出现 8.1.7 的解决办法
1. GS产品 连接oracle数据库时出现错误图示 2. 其实解决这个问题的办法很简单 一般是 修改一下 Oracle的app 目录的权限 最简单的办法是增加 everyone 权限 然后重启机器即 ...
- IDEA 修改 jdk 版本
3步 一 file--setting 二 file--Project Structure 三 file--Project Structure
- Oracle中对number类型数据to_char()出现各位少0,或者值为###的处理
问题描述: 在Oracle中使用to_char()函数时当number值为小数时,常常个位0不显示 比如:select to_char(0.02) from dual,结果为.02 改进为 selec ...
- 【转】电源芯片选型,容易忽略的“QC”
某公司自主研发的智能水表刚上市半年,随后此产品陆续接到用户投诉没电的情况,公司售后不得不花大量人力到用户现场更换电池,处理异常,导致公司损失惨重.但是该产品说明书中标称电池可以工作三年,为何半年左右电 ...
- 【转】在windows中使用Intellij Idea时选择自定义的64位JVM
原文地址:https://www.iflym.com/index.php/code/201404190001.html 本文英文原文自:https://intellij-support.jetbrai ...