URL地址为:http://IP:PORT/msg/HttpBatchSendSM
注:其中IP:PORT为服务部署的地址和端口
IP为61.152.239.206
,PORT默认:80
参数定义
序号 | 参数 | 说明 |
---|---|---|
1 | account | 必填参数。用户账号 |
2 | pswd | 必填参数。用户密码 |
3 | mobile | 必填参数。合法的手机号码 |
4 | msg | 必填参数。短信内容,短信内容长度不能超过585个字符。使用URL方式编码为UTF-8格式。短信内容超过70个字符(企信通是60个字符)时,会被拆分成多条,然后以长短信的格式发送。 |
5 | needstatus | 必填参数。是否需要状态报告,取值true或false,true,表明需要状态报告;false不需要状态报告 |
6 | product | 可选参数。用户订购的产品id |
7 | extno | 可选参数,扩展码 |
短信提交响应
用户短信通过http请求提交到服务器后,服务器返回响应码,响应码的格式如下:
resptime,respstatus
msgid
短信提交响应分为两行,第一行为响应时间和状态,第二行为服务器给出提交msgid。无论发送的号码是多少,一个发送请求只返回一个msgid,如果响应的状态不是"0",则没有msgid即第二行数据。(每行以换行符(0x0a,即\n)分割)
具体响应状态值,请咨询客户经理
535彩票投注管理员设置用户账户需要状态报告,并且也配置了账户的状态报告接收地址,则用户可以接收到其发送短信的状态报告。用户侧启动一个HTTP服务用于接收状态报告
参数定义
序号 | 参数 | 说明 |
---|---|---|
1 | receiver | 接收状态报告验证的用户名(不是账户名),是按照用户要求配置的名称,可以为空 |
2 | pswd | 接收状态报告验证的密码,可以为空 |
3 | msgid | 提交短信时平台返回的msgid,参见1.2 |
4 | reportTime | 格式YYMMDDhhmm,其中YY=年份的最后两位(00-99),MM=月份(01-12),DD=日(01-31),hh=小时(00-23),mm=分钟(00-59) |
5 | mobile | 单一的手机号码 |
6 | status | 状态报告数值 |
535彩票投注具体响应状态值,请咨询客户经理
535彩票投注URL地址为:http://IP:PORT/msg/QueryBalance
535彩票投注注:其中IP:PORT为服务部署的地址和端口
IP为61.152.239.206,PORT默认为:80
参数定义
序号 | 参数 | 说明 |
---|---|---|
2 | account | 必填参数。用户账号 |
2 | pswd | 必填参数。用户密码 |
提交响应
用户短信通过http请求提交到服务器后,服务器返回响应码,响应码的格式如下:
resptime,respstatus
product,count
第一行显示返回额度时的时间,提交响应值。 第二行开始,每一行显示一个产品ID及其额度,有多少个产品显示多少行。
具体响应状态值,请咨询客户经理
短信发送接口,最多可以一次提交50000个手机号码
public static String batchSend(String url,String account, String pswd, String mobile, String msg,
boolean needstatus, String product, String extno) throws Exception
url | 应用地址,类似于http://ip:port/msg/,如http://61.152.239.206/msg/ |
account | 账号 |
pswd | 密码 |
mobile | 手机号码,多个号码使用","分割 |
msg | 短信内容 |
needstatus | 是否需要状态报告,需要true,不需要false |
product | 产品ID |
extno | 扩展码,最多可以扩展6位 |
Returns:
返回值定义参见《平台接口说明》
<?php /* *@api 燃思php对接短信接口 */ class ChuanglanSmsApi { /** * 发送短信 * * @param string $mobile 手机号码 * @param string $msg 短信内容 * @param string $needstatus 是否需要状态报告 * @param string $product 产品id,可选 * @param string $extno 扩展码,可选 */ public function sendSMS( $mobile, $msg, $needstatus = 'false', $product = '', $extno = '') { global $chuanglan_config; //燃思接口参数 $postArr = array ( 'account' => $chuanglan_config['api_account'], 'pswd' => $chuanglan_config['api_password'], 'msg' => $msg, 'mobile' => $mobile, 'needstatus' => $needstatus, 'product' => $product, 'extno' => $extno ); $result = $this->curlPost( $chuanglan_config['api_send_url'] , $postArr); return $result; } /** * 查询额度 * * 查询地址 */ public function queryBalance() { global $chuanglan_config; //查询参数 $postArr = array ( 'account' => $chuanglan_config['api_account'], 'pswd' => $chuanglan_config['api_password'], ); $result = $this->curlPost($chuanglan_config['api_balance_query_url'], $postArr); return $result; } /** * 处理返回值 **/ public function execResult($result){ $result=preg_split("/[,\r\n]/",$result); return $result; } /** * 通过CURL发送HTTP请求 * @param string $url //请求URL * @param array $postFields //请求参数 * @return mixed */ private function curlPost($url,$postFields){ $postFields = http_build_query($postFields); $ch = curl_init (); curl_setopt ( $ch, CURLOPT_POST, 1 ); curl_setopt ( $ch, CURLOPT_HEADER, 0 ); curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $ch, CURLOPT_URL, $url ); curl_setopt ( $ch, CURLOPT_POSTFIELDS, $postFields ); $result = curl_exec ( $ch ); curl_close ( $ch ); return $result; } //魔术获取 public function __get($name){ return $this->$name; } //魔术设置 public function __set($name,$value){ $this->$name=$value; } } $api =new ChuanglanSmsApi();//调用api ?>
import com.bcloud.msg.http.HttpSender; public class HttpSenderTest { public static void main(String[] args) { String url = "http://61.152.239.206/msg/";// 应用地址 String account = "询问对接人";// 账号 String pswd = "询问对接人";// 密码 String mobile = "13800210021,13800138000";// 手机号码,多个号码使用","分割 String msg = "亲爱的用户,您的验证码是123456,5分钟内有效。";// 短信内容 boolean needstatus = true;// 是否需要状态报告,需要true,不需要false String product = null;// 产品ID String extno = null;// 扩展码 try { String returnString = HttpSender.batchSend(url, account, pswd, mobile, msg, needstatus, product, extno); System.out.println(returnString); // TODO 处理返回值,参见HTTP协议文档 } catch (Exception e) { // TODO 处理异常 e.printStackTrace(); } } }
代码 | 说明 |
---|---|
0 | 提交成功 |
101 | 无此用户 |
102 | 密码错 |
103 | 提交过快(提交速度超过流速限制 |
104 | 系统忙(因平台侧原因,暂时无法处理提交的短信) |
105 | 敏感短信(短信内容包含敏感词) |
106 | 消息长度错(>536或<=0) |
107 | 包含错误的手机号码 |
108 | 手机号码个数错(群发>50000或<=0;单发>200或<=0) |
109 | 无发送额度(该用户可用短信数已使用完) |
110 | 不在发送时间内 |
111 | 超出该账户当月发送额度限制 |
112 | 无此产品,用户没有订购该产品 |
113 | extno格式错(非数字或者长度不对) |
115 | 自动审核驳回 |
116 | 签名不合法,未带签名(用户必须带签名的前提下) |
117 | IP地址认证错,请求调用的IP地址不是系统登记的IP地址 |
118 | 用户没有相应的发送权限 |
119 | 用户已过期 |
120 | 短信内容不在白名单中 |
状态值(字符串) | 说明 |
---|---|
DELIVRD | 短消息转发成功 |
EXPIRED | 短消息超过有效期 |
UNDELIV | 短消息是不可达的 |
UNKNOWN | 未知短消息状态 |
REJECTD | 短消息被短信中心拒绝 |
DTBLACK | 目的号码是黑名单号码 |
ERR:104 | 系统忙 |
REJECT | 审核驳回 |
其他 | 网关内部状态 |
代码 | 说明 |
---|---|
0 | 成功 |
101 | 无此用户 |
102 | 密码错 |
103 | 查询过快(30秒查询一次) |