互亿无线 · 文档中心

彩信/视频短信 - 代码示例


PHP对接彩信/视频短信接口DEMO示例
本文为您提供了PHP语言版本的彩信/视频短信接口对接DEMO示例

彩信/视频短信接口文档 点击下载

彩信/视频短信接口接入指南 点击访问

//发送短信测试

//打开php.ini文件中的 always_populate_raw_post_data = -1;
header("Content-type:text/html; charset=UTF-8");

require 'ihuyi/sms.class.php';
$config = require 'ihuyi/config.php';

$sms = new sms($config);

$mobile = array('XXXXXX','XXXXXX');
$content = makecontent();
$title = "测试";
$product_id = 1016;
$sign_name = '您的签名';

//发送短信
$res = $sms->send($mobile, $content,$title, $product_id, $sign_name);
$sms->log('send', $res);
print_r($res);

function makecontent()
{
    $data = array(
        //第一帧
        array(
            array(//文本
                'con_type' => 'text',
                'ext_type' => 'txt',
                'data'     => '短信内容1'
            ),
            array(//图片
                'con_type' => 'image',
                'ext_type' => 'jpg',
                'data'     => base64_encode(file_get_contents('yourFileFolder/test-jpg1.jpg'))
            )
        ),
        array(//第二帧
            array(//音频
                'con_type' => 'audio',
                'ext_type' => 'mp3',
                'data'     => base64_encode(file_get_contents('yourFileFolder/test-mp31.mp3'))
            ),
            array(//文本
                'con_type' => 'text',
                'ext_type' => 'txt',
                'data'     => '第二帧音频'
            ),
        ),
        array(//第三帧
            array(//视频
                'con_type' => 'video',
                'ext_type' => 'mp4',
                'data'     => base64_encode(file_get_contents('yourFileFolder/test-mp41.mp4')) 
            )
        )
    );
    return $data;
}

现在注册,即享新用户礼包!

在线咨询
电话咨询
服务热线:
4008 808 898



验证码已发送到您的手机,请查收!

填写验证码后,点击“开通体验账户”自动开通体验账户。

收不到短信验证码?
×