创蓝云智 API
    创蓝云智 API
    • 创蓝短信API文档介绍
    • 开发引导
    • 1.2.1调用说明
    • 1.2.2DEMO下载
    • 1.2.3常见问题
    • PHP DEMO
    • C# DEMO
    • Asp DEMO
    • go demo
    • Node.js DEMO
    • Python DEMO
    • java DEMO
    • 1.3应用场景_普通短信
    • 1.3应用场景_变量短信
    • 短信API接口列表
    • 1.6.1返回码示例
    • 1.6.2.1接口返回码
    • 1.6.2.2个性化接口返回码
    • 1.6.2.3定制接口返回码
    • 1.6.3.1国际接口响应码
    • 1.7.1服务协议
    • 开发引导
    • 1.2.1调用说明
    • 1.2.2DEMO下载
    • 1.2.3常见问题
    • PHP DEMO
    • C# DEMO
    • Asp DEMO
    • go demo
    • Node.js DEMO
    • Python DEMO
    • java DEMO
    • 1.3应用场景_普通短信
    • 1.3应用场景_变量短信
    • 短信API接口列表
    • 1.6.1返回码示例
    • 1.6.2.1接口返回码
    • 1.6.2.2个性化接口返回码
    • 1.6.2.3定制接口返回码
    • 1.6.3.1国际接口响应码
    • 1.7.1服务协议
    • 短信API接口列表
    • 短信API接口列表
    • 1.1介绍
      • 创蓝短信API文档介绍
    • 1.2开发引导
      • 开发引导
      • 1.2.1调用说明
      • 1.2.2DEMO下载
      • 1.2.3常见问题
      • 1.2.4代码示例
        • PHP DEMO
        • C# DEMO
        • Asp DEMO
        • go demo
        • Node.js DEMO
        • Python DEMO
        • java DEMO
    • 1.3使用场景
      • 1.3应用场景_普通短信
      • 1.3应用场景_变量短信
      • 调通短信接口
      • 变量短信发送
    • 1.4国内短信
      • 短信API接口列表
      • 相同内容群发接口
      • 相同内容变量接口
      • 余额查询接口
      • 回送上行明细接口
      • 拉取上行明细接口
      • 拉取状态报告
      • 回送状态报告
    • 1.5国际短信
      • 国际短信发送
        • 国际短信单条发送接口
        • 国际短信群发送接口
      • 推送明细说明
        • 推送状态报告
        • 推送上行明细
      • 拉取明细说明
        • 拉取状态报告
        • 拉取上行明细
    • 1.6返回码说明
      • 1.6.1返回码示例
      • 1.6.2国内接口返回码
        • 1.6.2.1接口返回码
        • 1.6.2.2个性化接口返回码
        • 1.6.2.3定制接口返回码
      • 1.6.3国际接口返回码
        • 1.6.3.1国际接口响应码
    • 1.7协议
      • 1.7.1服务协议

    PHP DEMO

    功能说明:该接口要求提前在253后台添加模板,提交短信时,系统会自动匹配审核通过的模板,匹配成功任意一个模板即可发送。签名和短信内容需要提前在253云通讯后台报备,审核通过后即可发送。
    <?php          
    /**
     * Created by PhpStorm.
     * User: ycy
     * Date: 2018/5/26
     * Time: 17:12
     */
    
    http://zabbix.253.com/zabbixheader("Content-Type:text/html;charset=utf-8"\
    );
    //$code = mt_rand(100000,999999);
        $clapi=newChuanglanSmsApi();
    //设置您要发送的内容:其中“【】”中括号为运营商签名符号,多签名内容前置添加提交
    //普通短信发送调用
    $result= $clapi->sendSMS('18516627499','【253云通讯】您好,您的验证码是123456' );
    if(!is_null(json_decode($result))){
    $output=json\_decode\($result,**true**\);
    if(isset($output['code'])  && $output['code']=='0'){
    echo'发送成功';
        }else{
    echo$output['errorMsg'];
        }
    }else{
    echo$result;
    }
    class  ChuanglanSmsApi
    {
    //参数的配置请登录zz.253.com获取以下API信息↓↓↓↓↓↓↓
    constAPI_SEND_URL='
    http://smssh1.253.com/msg/send/json
    '; //创蓝发送短信接口URL
    constAPI_VARIABLE_URL='[[
    http://smssh1.253.com/msg/variable/json';//创蓝变量短信接口URL](http://smssh1.253.com/msg/variable/json';//创蓝变量短信接口URL](http://smssh1.253.com/msg/variable/json';//创蓝变量短信接口URL](http://smssh1.253.com/msg/variable/json';//创蓝变量短信接口URL)\\\
    )
    constAPI_BALANCE_QUERY_URL='[[
    http://smssh1.253.com/msg/balance/json';//创蓝短信余额查询接口URL](http://smssh1.253.com/msg/balance/json';//创蓝短信余额查询接口URL](http://smssh1.253.com/msg/balance/json';//创蓝短信余额查询接口URL](http://smssh1.253.com/msg/balance/json';//创蓝短信余额查询接口URL)\\\
    )
    constAPI_ACCOUNT= 'N57***'; //创蓝API账号
    constAPI_PASSWORD= '*******';//创蓝API密码
    /**
         *发送短信
    *
         *@paramstring $mobile手机号码
    *@paramstring $msg短信内容
    *@paramstring $needstatus是否需要状态报告
    */
    functionsendSMS($mobile, $msg, $needstatus = 'true')
        {
        //创蓝接口参数
        $postArr =array(
                'account' =>self::API_ACCOUNT,
                'password' =>self::API_PASSWORD,
                'msg' => urlencode($msg),
                'phone' => $mobile,
                'report' => $needstatus
            );
            $result = $this->curlPost(self::API_SEND_URL, $postArr);
            //var_dump($postArr);die();
    return$result;
        }
    /**
         *发送变量短信
    *
         *@paramstring $msg短信内容
    *@paramstring $params至多不能超过1000个参数组
    */
    functionsendVariableSMS($msg, $params)
        {
    global$chuanglan_config;
            //创蓝接口参数
    $postArr =array(
                'account' =>self::API_ACCOUNT,
                'password' =>self::API_PASSWORD,
                'msg' => $msg,
                'params' => $params,
                'report' => 'true'
            );
            $result = $this-&gt;curlPost\(**self**::API\_VARIABLE\_URL, $postArr\);
    return$result; }
    
    /** *查询额度 * * 查询地址 */ functionqueryBalance() { global$chuanglan_config;
    
    $result = $this-&gt;curlPost\(**self**::API\_VARIABLE\_URL, $postArr\);
    return$result;
        }
    /**
         *查询额度
    *
         *  查询地址
    */
    functionqueryBalance()
        {
    global$chuanglan_config;
    
    //查询参数
    $postArr =array( 'account' =>self::API_ACCOUNT, 'password' =>self::API_PASSWORD, ); $result = $this->curlPost(self::API_BALANCE_QUERY_URL, $postArr); return$result; }
    
    /** *通过CURL发送HTTP请求 *@paramstring $url //请求URL *@paramarray $postFields //请求参数 *@returnmixed * */ functioncurlPost($url, $postFields) { $postFields = json_encode($postFields); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_HTTPHEADER,array( 'Content-Type: application/json; charset=utf-8' //json版本需要填写 Content-Type: application/json; ) ); curl_setopt($ch,CURLOPT_IPRESOLVE,CURL_IPRESOLVE_V4); curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_POST, 1); curl_setopt($ch,CURLOPT_POSTFIELDS, $postFields); curl_setopt($ch,CURLOPT_TIMEOUT, 60); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, 0); $ret = curl_exec($ch); if(false== $ret) { $result = curl_error($ch); }else{ $rsp = curl_getinfo($ch,CURLINFO_HTTP_CODE); if(200 != $rsp) { $result = "请求状态" . $rsp . "" . curl_error($ch); }else{ $result = $ret; } } curl_close($ch); return$result; }
    
    }

    【创蓝云智】API开发者 微信交流群

    用微信扫右侧二维码,加入【创蓝云智】API开发者 交流群,互助沟通

    扫码加入交流群
    上一页
    1.2.3常见问题
    下一页
    C# DEMO
    Built with