├── docs ├── opensearch.xml ├── PROJECT_VERSION ├── SAMI_VERSION ├── images │ ├── image1.png │ ├── image2.png │ ├── image3.png │ ├── image4.png │ ├── image5.png │ ├── image6.png │ ├── image7.png │ ├── image8.png │ └── image9.png ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── renderer.index ├── interfaces.html ├── traits.html ├── Qcloud.html ├── index.html ├── namespaces.html ├── search.html ├── classes.html ├── Qcloud │ ├── Sms.html │ └── Sms │ │ ├── VoiceFileUploader.html │ │ ├── FileVoiceSender.html │ │ ├── SmsVoiceVerifyCodeSender.html │ │ ├── TtsVoiceSender.html │ │ ├── SmsVoicePromptSender.html │ │ ├── SmsStatusPuller.html │ │ ├── SmsMobileStatusPuller.html │ │ ├── SmsMultiSender.html │ │ └── SmsSingleSender.html ├── css │ └── sami.css └── doc-index.html ├── .gitignore ├── gendoc.sh ├── demo ├── README.md ├── composer │ ├── README.md │ ├── composer.json │ └── app.php └── simple │ └── app.php ├── composer.json ├── sami_config.php ├── src ├── index.php ├── VoiceFileUploader.php ├── SmsStatusPuller.php ├── FileVoiceSender.php ├── SmsVoiceVerifyCodeSender.php ├── TtsVoiceSender.php ├── SmsVoicePromptSender.php ├── SmsMobileStatusPuller.php ├── SmsMultiSender.php ├── SmsSingleSender.php └── SmsSenderUtil.php ├── LICENSE └── README.md /docs/opensearch.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/PROJECT_VERSION: -------------------------------------------------------------------------------- 1 | master -------------------------------------------------------------------------------- /docs/SAMI_VERSION: -------------------------------------------------------------------------------- 1 | 4.0.14-DEV -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | .env 3 | /cache 4 | composer.lock 5 | /vendor 6 | -------------------------------------------------------------------------------- /docs/images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image1.png -------------------------------------------------------------------------------- /docs/images/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image2.png -------------------------------------------------------------------------------- /docs/images/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image3.png -------------------------------------------------------------------------------- /docs/images/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image4.png -------------------------------------------------------------------------------- /docs/images/image5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image5.png -------------------------------------------------------------------------------- /docs/images/image6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image6.png -------------------------------------------------------------------------------- /docs/images/image7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image7.png -------------------------------------------------------------------------------- /docs/images/image8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image8.png -------------------------------------------------------------------------------- /docs/images/image9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/images/image9.png -------------------------------------------------------------------------------- /gendoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | composer install 4 | php ./vendor/sami/sami/sami.php update ./sami_config.php -v 5 | -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcloudsms/qcloudsms_php/HEAD/docs/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /demo/README.md: -------------------------------------------------------------------------------- 1 | 腾讯云短信 PHP SDK DEMO 2 | ===== 3 | 4 | 5 | ## 使用composer 6 | 7 | 使用composer的项目请参考 `composer` 目录 8 | 9 | 10 | ## 不使用composer 11 | 12 | 没有使用composer的项目请参考 `simple` 目录 13 | -------------------------------------------------------------------------------- /demo/composer/README.md: -------------------------------------------------------------------------------- 1 | 腾讯云短信 PHP SDK Demo 2 | === 3 | 4 | ## 使用 5 | 6 | 1. 安装依赖 7 | 8 | ```sh 9 | php /path/to/composer install 10 | ``` 11 | 12 | 2. 配置必要参数,如SDK appid/appkey 13 | 14 | ```sh 15 | emacs app.php 16 | ``` 17 | 18 | 3. 运行 19 | 20 | ```sh 21 | php ./app.php 22 | ``` 23 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "qcloudsms/qcloudsms_php", 3 | "type": "library", 4 | "description": "qcloud sms php sdk", 5 | "keywords": ["qcloud", "sms", "php", "sdk"], 6 | "license": "MIT", 7 | "autoload": { 8 | "psr-4": { 9 | "Qcloud\\Sms\\": "src/" 10 | } 11 | }, 12 | "require-dev": { 13 | "sami/sami": "dev-master" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demo/composer/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "qcloudsms_demo", 3 | "description": "qcloudms demo", 4 | "type": "project", 5 | "license": "mit", 6 | "authors": [ 7 | { 8 | "name": "qcloudsms", 9 | "email": "qcloudsms@yeah.net" 10 | } 11 | ], 12 | "minimum-stability": "dev", 13 | "require": { 14 | "qcloudsms/qcloudsms_php": "*" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sami_config.php: -------------------------------------------------------------------------------- 1 | files() 9 | ->name("*.php") 10 | ->exclude("Resources") 11 | ->exclude("Tests") 12 | ->in(__DIR__."/src/"); 13 | 14 | return new Sami($iterator, array( 15 | "build_dir" => __DIR__."/docs", 16 | "cache_dir" => __DIR__."/cache", 17 | )); 18 | -------------------------------------------------------------------------------- /src/index.php: -------------------------------------------------------------------------------- 1 | url = "https://cloud.tim.qq.com/v5/tlsvoicesvr/uploadvoicefile"; 31 | $this->appid = $appid; 32 | $this->appkey = $appkey; 33 | $this->util = new SmsSenderUtil(); 34 | } 35 | 36 | /** 37 | * 38 | * 上传语音文件 39 | * 40 | * @param string $fileContent 语音文件内容 41 | * @param string $contentType 语音文件类型,目前支持 VoiceFileUploader::WAV 和 VoiceFileUploader::MP3 42 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 43 | */ 44 | public function upload($fileContent, $contentType) 45 | { 46 | assert($contentType == self::WAV || $contentType == self::MP3); 47 | 48 | $random = $this->util->getRandom(); 49 | $curTime = time(); 50 | $fileSha1Sum = $this->util->sha1sum($fileContent); 51 | $auth = $this->util->calculateAuth($this->appkey, $random, 52 | $curTime, $fileSha1Sum); 53 | 54 | $req = new \stdClass(); 55 | $req->url = $this->url . "?sdkappid=" . $this->appid 56 | . "&random=" . $random . "&time=" . $curTime; 57 | $req->body = $fileContent; 58 | $req->headers = array( 59 | "Content-Type: " . $contentType, 60 | "x-content-sha1: " . $fileSha1Sum, 61 | "Authorization: " . $auth 62 | ); 63 | 64 | return $this->util->fetch($req); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/SmsStatusPuller.php: -------------------------------------------------------------------------------- 1 | url = "https://yun.tim.qq.com/v5/tlssmssvr/pullstatus"; 27 | $this->appid = $appid; 28 | $this->appkey = $appkey; 29 | $this->util = new SmsSenderUtil(); 30 | } 31 | 32 | /** 33 | * 拉取回执结果 34 | * 35 | * @param int $type 拉取类型,0表示回执结果,1表示回复信息 36 | * @param int $max 最大条数,最多100 37 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 38 | */ 39 | private function pull($type, $max) 40 | { 41 | $random = $this->util->getRandom(); 42 | $curTime = time(); 43 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 44 | 45 | $data = new \stdClass(); 46 | $data->sig = $this->util->calculateSigForPuller($this->appkey, $random, $curTime); 47 | $data->time = $curTime; 48 | $data->type = $type; 49 | $data->max = $max; 50 | 51 | return $this->util->sendCurlPost($wholeUrl, $data); 52 | } 53 | 54 | /** 55 | * 拉取回执结果 56 | * 57 | * @param int $max 拉取最大条数,最多100 58 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 59 | */ 60 | public function pullCallback($max) 61 | { 62 | return $this->pull(0, $max); 63 | } 64 | 65 | /** 66 | * 拉取回复信息 67 | * 68 | * @param int $max 拉取最大条数,最多100 69 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 70 | */ 71 | public function pullReply($max) 72 | { 73 | return $this->pull(1, $max); 74 | } 75 | } -------------------------------------------------------------------------------- /src/FileVoiceSender.php: -------------------------------------------------------------------------------- 1 | url = "https://cloud.tim.qq.com/v5/tlsvoicesvr/sendfvoice"; 28 | $this->appid = $appid; 29 | $this->appkey = $appkey; 30 | $this->util = new SmsSenderUtil(); 31 | } 32 | 33 | /** 34 | * 35 | * 按语音文件fid发送语音通知 36 | * 37 | * @param string $nationCode 国家码,如 86 为中国 38 | * @param string $phoneNumber 不带国家码的手机号 39 | * @param string $fid 语音文件fid 40 | * @param string $playtimes 播放次数,可选,最多3次,默认2次 41 | * @param string $ext 用户的session内容,服务端原样返回,可选字段,不需要可填空串 42 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 43 | */ 44 | public function send($nationCode, $phoneNumber, $fid, $playtimes = 2, $ext = "") 45 | { 46 | $random = $this->util->getRandom(); 47 | $curTime = time(); 48 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 49 | 50 | // 按照协议组织 post 包体 51 | $data = new \stdClass(); 52 | $tel = new \stdClass(); 53 | $tel->nationcode = "".$nationCode; 54 | $tel->mobile = "".$phoneNumber; 55 | $data->tel = $tel; 56 | $data->fid = $fid; 57 | if ($playtimes == 1) { 58 | $data->playtimes = 1; 59 | } else if ($playtimes == 3) { 60 | $data->playtimes = 3; 61 | } else { 62 | $data->playtimes = 2; 63 | } 64 | 65 | // app凭证 66 | $data->sig = $this->util->calculateSig($this->appkey, $random, 67 | $curTime, array($phoneNumber)); 68 | 69 | // unix时间戳,请求发起时间,如果和系统时间相差超过10分钟则会返回失败 70 | $data->time = $curTime; 71 | $data->ext = $ext; 72 | 73 | return $this->util->sendCurlPost($wholeUrl, $data); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/SmsVoiceVerifyCodeSender.php: -------------------------------------------------------------------------------- 1 | url = "https://cloud.tim.qq.com/v5/tlsvoicesvr/sendvoice"; 27 | $this->appid = $appid; 28 | $this->appkey = $appkey; 29 | $this->util = new SmsSenderUtil(); 30 | } 31 | 32 | /** 33 | * 发送语音验证码 34 | * 35 | * @param string $nationCode 国家码,如 86 为中国 36 | * @param string $phoneNumber 不带国家码的手机号 37 | * @param string $msg 信息内容,必须与申请的模板格式一致,否则将返回错误 38 | * @param int $playtimes 播放次数,可选,最多3次,默认2次 39 | * @param string $ext 用户的session内容,服务端原样返回,可选字段,不需要可填空串 40 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 41 | */ 42 | public function send($nationCode, $phoneNumber, $msg, $playtimes = 2, $ext = "") 43 | { 44 | $random = $this->util->getRandom(); 45 | $curTime = time(); 46 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 47 | 48 | // 按照协议组织 post 包体 49 | $data = new \stdClass(); 50 | $tel = new \stdClass(); 51 | $tel->nationcode = "".$nationCode; 52 | $tel->mobile = "".$phoneNumber; 53 | 54 | $data->tel = $tel; 55 | $data->msg = $msg; 56 | if ($playtimes == 1) { 57 | $data->playtimes = 1; 58 | } else if ($playtimes == 3) { 59 | $data->playtimes = 3; 60 | } else { 61 | $data->playtimes = 2; 62 | } 63 | 64 | // app凭证 65 | $data->sig = hash("sha256", 66 | "appkey=".$this->appkey."&random=".$random."&time=" 67 | .$curTime."&mobile=".$phoneNumber, FALSE); 68 | // unix时间戳,请求发起时间,如果和系统时间相差超过10分钟则会返回失败 69 | $data->time = $curTime; 70 | $data->ext = $ext; 71 | 72 | return $this->util->sendCurlPost($wholeUrl, $data); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/TtsVoiceSender.php: -------------------------------------------------------------------------------- 1 | url = "https://cloud.tim.qq.com/v5/tlsvoicesvr/sendtvoice"; 28 | $this->appid = $appid; 29 | $this->appkey = $appkey; 30 | $this->util = new SmsSenderUtil(); 31 | } 32 | 33 | /** 34 | * 35 | * 指定模板发送语音短信 36 | * 37 | * @param string $nationCode 国家码,如 86 为中国 38 | * @param string $phoneNumber 不带国家码的手机号 39 | * @param int $templId 模板 id 40 | * @param array $params 模板参数列表,如模板 {1}...{2}...{3},需要带三个参数 41 | * @param string $playtimes 播放次数,可选,最多3次,默认2次 42 | * @param string $ext 用户的session内容,服务端原样返回,可选字段,不需要可填空串 43 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 44 | */ 45 | public function send($nationCode, $phoneNumber, $templId, $params, $playtimes = 2, $ext = "") 46 | { 47 | $random = $this->util->getRandom(); 48 | $curTime = time(); 49 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 50 | 51 | // 按照协议组织 post 包体 52 | $data = new \stdClass(); 53 | $tel = new \stdClass(); 54 | $tel->nationcode = "".$nationCode; 55 | $tel->mobile = "".$phoneNumber; 56 | $data->tel = $tel; 57 | $data->tpl_id = $templId; 58 | $data->params = $params; 59 | if ($playtimes == 1) { 60 | $data->playtimes = 1; 61 | } else if ($playtimes == 3) { 62 | $data->playtimes = 3; 63 | } else { 64 | $data->playtimes = 2; 65 | } 66 | 67 | // app凭证 68 | $data->sig = $this->util->calculateSig($this->appkey, $random, 69 | $curTime, array($phoneNumber)); 70 | 71 | // unix时间戳,请求发起时间,如果和系统时间相差超过10分钟则会返回失败 72 | $data->time = $curTime; 73 | $data->ext = $ext; 74 | 75 | return $this->util->sendCurlPost($wholeUrl, $data); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/SmsVoicePromptSender.php: -------------------------------------------------------------------------------- 1 | url = "https://cloud.tim.qq.com/v5/tlsvoicesvr/sendvoiceprompt"; 27 | $this->appid = $appid; 28 | $this->appkey = $appkey; 29 | $this->util = new SmsSenderUtil(); 30 | } 31 | 32 | /** 33 | * 34 | * 发送语音通知 35 | * 36 | * @param string $nationCode 国家码,如 86 为中国 37 | * @param string $phoneNumber 不带国家码的手机号 38 | * @param string $prompttype 语音类型,目前固定为2 39 | * @param string $msg 信息内容,必须与申请的模板格式一致,否则将返回错误 40 | * @param string $playtimes 播放次数,可选,最多3次,默认2次 41 | * @param string $ext 用户的session内容,服务端原样返回,可选字段,不需要可填空串 42 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 43 | */ 44 | public function send($nationCode, $phoneNumber, $prompttype, $msg, $playtimes = 2, $ext = "") 45 | { 46 | $random = $this->util->getRandom(); 47 | $curTime = time(); 48 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 49 | 50 | // 按照协议组织 post 包体 51 | $data = new \stdClass(); 52 | $tel = new \stdClass(); 53 | $tel->nationcode = "".$nationCode; 54 | $tel->mobile = "".$phoneNumber; 55 | 56 | $data->tel = $tel; 57 | // 通知内容,utf8编码,支持中文英文、数字及组合,需要和语音内容模版相匹配 58 | $data->promptfile = $msg; 59 | // 固定值 2 60 | $data->prompttype = $prompttype; 61 | 62 | if ($playtimes == 1) { 63 | $data->playtimes = 1; 64 | } else if ($playtimes == 3) { 65 | $data->playtimes = 3; 66 | } else { 67 | $data->playtimes = 2; 68 | } 69 | 70 | // app凭证 71 | $data->sig = hash("sha256", 72 | "appkey=".$this->appkey."&random=".$random."&time=" 73 | .$curTime."&mobile=".$phoneNumber, FALSE); 74 | // unix时间戳,请求发起时间,如果和系统时间相差超过10分钟则会返回失败 75 | $data->time = $curTime; 76 | $data->ext = $ext; 77 | 78 | return $this->util->sendCurlPost($wholeUrl, $data); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/SmsMobileStatusPuller.php: -------------------------------------------------------------------------------- 1 | url = "https://yun.tim.qq.com/v5/tlssmssvr/pullstatus4mobile"; 27 | $this->appid = $appid; 28 | $this->appkey = $appkey; 29 | $this->util = new SmsSenderUtil(); 30 | } 31 | 32 | /** 33 | * 拉取回执结果 34 | * 35 | * @param int $type 拉取类型,0表示回执结果,1表示回复信息 36 | * @param string $nationCode 国家码,如 86 为中国 37 | * @param string $mobile 不带国家码的手机号 38 | * @param int $beginTime 开始时间(unix timestamp) 39 | * @param int $endTime 结束时间(unix timestamp) 40 | * @param int $max 拉取最大条数,最多100 41 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 42 | */ 43 | private function pull($type, $nationCode, $mobile, $beginTime, $endTime, $max) 44 | { 45 | $random = $this->util->getRandom(); 46 | $curTime = time(); 47 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 48 | 49 | $data = new \stdClass(); 50 | $data->sig = $this->util->calculateSigForPuller($this->appkey, $random, $curTime); 51 | $data->time = $curTime; 52 | $data->type = $type; 53 | $data->max = $max; 54 | $data->begin_time = $beginTime; 55 | $data->end_time = $endTime; 56 | $data->nationcode = $nationCode; 57 | $data->mobile = $mobile; 58 | 59 | return $this->util->sendCurlPost($wholeUrl, $data); 60 | } 61 | 62 | /** 63 | * 拉取回执结果 64 | * 65 | * @param string $nationCode 国家码,如 86 为中国 66 | * @param string $mobile 不带国家码的手机号 67 | * @param int $beginTime 开始时间(unix timestamp) 68 | * @param int $endTime 结束时间(unix timestamp) 69 | * @param int $max 拉取最大条数,最多100 70 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 71 | */ 72 | public function pullCallback($nationCode, $mobile, $beginTime, $endTime, $max) 73 | { 74 | return $this->pull(0, $nationCode, $mobile, $beginTime, $endTime, $max); 75 | } 76 | 77 | /** 78 | * 拉取回复信息 79 | * 80 | * @param string $nationCode 国家码,如 86 为中国 81 | * @param string $mobile 不带国家码的手机号 82 | * @param int $beginTime 开始时间(unix timestamp) 83 | * @param int $endTime 结束时间(unix timestamp) 84 | * @param int $max 拉取最大条数,最多100 85 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 86 | */ 87 | public function pullReply($nationCode, $mobile, $beginTime, $endTime, $max) 88 | { 89 | return $this->pull(1, $nationCode, $mobile, $beginTime, $endTime, $max); 90 | } 91 | } -------------------------------------------------------------------------------- /src/SmsMultiSender.php: -------------------------------------------------------------------------------- 1 | url = "https://yun.tim.qq.com/v5/tlssmssvr/sendmultisms2"; 27 | $this->appid = $appid; 28 | $this->appkey = $appkey; 29 | $this->util = new SmsSenderUtil(); 30 | } 31 | 32 | /** 33 | * 普通群发 34 | * 35 | * 普通群发需明确指定内容,如果有多个签名,请在内容中以【】的方式添加到信息内容中, 36 | * 否则系统将使用默认签名。 37 | * 38 | * 39 | * @param int $type 短信类型,0 为普通短信,1 营销短信 40 | * @param string $nationCode 国家码,如 86 为中国 41 | * @param array $phoneNumbers 不带国家码的手机号列表 42 | * @param string $msg 信息内容,必须与申请的模板格式一致,否则将返回错误 43 | * @param string $extend 扩展码,可填空串 44 | * @param string $ext 服务端原样返回的参数,可填空串 45 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 46 | */ 47 | public function send($type, $nationCode, $phoneNumbers, $msg, $extend = "", $ext = "") 48 | { 49 | $random = $this->util->getRandom(); 50 | $curTime = time(); 51 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 52 | 53 | $data = new \stdClass(); 54 | $data->tel = $this->util->phoneNumbersToArray($nationCode, $phoneNumbers); 55 | $data->type = $type; 56 | $data->msg = $msg; 57 | $data->sig = $this->util->calculateSig($this->appkey, $random, 58 | $curTime, $phoneNumbers); 59 | $data->time = $curTime; 60 | $data->extend = $extend; 61 | $data->ext = $ext; 62 | 63 | return $this->util->sendCurlPost($wholeUrl, $data); 64 | } 65 | 66 | /** 67 | * 指定模板群发 68 | * 69 | * 70 | * @param string $nationCode 国家码,如 86 为中国 71 | * @param array $phoneNumbers 不带国家码的手机号列表 72 | * @param int $templId 模板id 73 | * @param array $params 模板参数列表,如模板 {1}...{2}...{3},那么需要带三个参数 74 | * @param string $sign 签名,如果填空串,系统会使用默认签名 75 | * @param string $extend 扩展码,可填空串 76 | * @param string $ext 服务端原样返回的参数,可填空串 77 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 78 | */ 79 | public function sendWithParam($nationCode, $phoneNumbers, $templId, $params, 80 | $sign = "", $extend = "", $ext = "") 81 | { 82 | $random = $this->util->getRandom(); 83 | $curTime = time(); 84 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 85 | 86 | $data = new \stdClass(); 87 | $data->tel = $this->util->phoneNumbersToArray($nationCode, $phoneNumbers); 88 | $data->sign = $sign; 89 | $data->tpl_id = $templId; 90 | $data->params = $params; 91 | $data->sig = $this->util->calculateSigForTemplAndPhoneNumbers( 92 | $this->appkey, $random, $curTime, $phoneNumbers); 93 | $data->time = $curTime; 94 | $data->extend = $extend; 95 | $data->ext = $ext; 96 | 97 | return $this->util->sendCurlPost($wholeUrl, $data); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /docs/interfaces.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Interfaces | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |
26 | 29 |
30 | 31 | 35 |
36 |
37 | 38 |
39 | 40 |
41 |
42 | 65 | 66 |
67 | 70 | 71 | 72 |
73 |
74 |
75 | 78 | 79 |
80 |
81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/traits.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Traits | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |
26 | 29 |
30 | 31 | 35 |
36 |
37 | 38 |
39 | 40 |
41 |
42 | 65 | 66 |
67 | 70 | 71 |
72 |
73 |
74 | 77 | 78 |
79 |
80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/SmsSingleSender.php: -------------------------------------------------------------------------------- 1 | url = "https://yun.tim.qq.com/v5/tlssmssvr/sendsms"; 27 | $this->appid = $appid; 28 | $this->appkey = $appkey; 29 | $this->util = new SmsSenderUtil(); 30 | } 31 | 32 | /** 33 | * 普通单发 34 | * 35 | * 普通单发需明确指定内容,如果有多个签名,请在内容中以【】的方式添加到信息内容中,否则系统将使用默认签名。 36 | * 37 | * @param int $type 短信类型,0 为普通短信,1 营销短信 38 | * @param string $nationCode 国家码,如 86 为中国 39 | * @param string $phoneNumber 不带国家码的手机号 40 | * @param string $msg 信息内容,必须与申请的模板格式一致,否则将返回错误 41 | * @param string $extend 扩展码,可填空串 42 | * @param string $ext 服务端原样返回的参数,可填空串 43 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 44 | */ 45 | public function send($type, $nationCode, $phoneNumber, $msg, $extend = "", $ext = "") 46 | { 47 | $random = $this->util->getRandom(); 48 | $curTime = time(); 49 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 50 | 51 | // 按照协议组织 post 包体 52 | $data = new \stdClass(); 53 | $tel = new \stdClass(); 54 | $tel->nationcode = "".$nationCode; 55 | $tel->mobile = "".$phoneNumber; 56 | 57 | $data->tel = $tel; 58 | $data->type = (int)$type; 59 | $data->msg = $msg; 60 | $data->sig = hash("sha256", 61 | "appkey=".$this->appkey."&random=".$random."&time=" 62 | .$curTime."&mobile=".$phoneNumber, FALSE); 63 | $data->time = $curTime; 64 | $data->extend = $extend; 65 | $data->ext = $ext; 66 | 67 | return $this->util->sendCurlPost($wholeUrl, $data); 68 | } 69 | 70 | /** 71 | * 指定模板单发 72 | * 73 | * @param string $nationCode 国家码,如 86 为中国 74 | * @param string $phoneNumber 不带国家码的手机号 75 | * @param int $templId 模板 id 76 | * @param array $params 模板参数列表,如模板 {1}...{2}...{3},那么需要带三个参数 77 | * @param string $sign 签名,如果填空串,系统会使用默认签名 78 | * @param string $extend 扩展码,可填空串 79 | * @param string $ext 服务端原样返回的参数,可填空串 80 | * @return string 应答json字符串,详细内容参见腾讯云协议文档 81 | */ 82 | public function sendWithParam($nationCode, $phoneNumber, $templId = 0, $params, 83 | $sign = "", $extend = "", $ext = "") 84 | { 85 | $random = $this->util->getRandom(); 86 | $curTime = time(); 87 | $wholeUrl = $this->url . "?sdkappid=" . $this->appid . "&random=" . $random; 88 | 89 | // 按照协议组织 post 包体 90 | $data = new \stdClass(); 91 | $tel = new \stdClass(); 92 | $tel->nationcode = "".$nationCode; 93 | $tel->mobile = "".$phoneNumber; 94 | 95 | $data->tel = $tel; 96 | $data->sig = $this->util->calculateSigForTempl($this->appkey, $random, 97 | $curTime, $phoneNumber); 98 | $data->tpl_id = $templId; 99 | $data->params = $params; 100 | $data->sign = $sign; 101 | $data->time = $curTime; 102 | $data->extend = $extend; 103 | $data->ext = $ext; 104 | 105 | return $this->util->sendCurlPost($wholeUrl, $data); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /docs/Qcloud.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |
26 | 29 |
30 | 31 | 35 |
36 |
37 | 38 |
39 | 40 |
41 |
42 | 65 | 66 |
67 | 71 |
72 |
73 | 74 | 77 | 78 |

Namespaces

79 |
80 | Qcloud\Sms
81 | 82 | 83 | 84 | 85 |
86 | 89 | 90 |
91 |
92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Namespaces | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |
26 | 29 |
30 | 31 | 35 |
36 |
37 | 38 |
39 | 40 |
41 |
42 | 65 | 66 |
67 | 70 | 71 |
72 |
73 |

Qcloud

74 | 78 |
79 |
80 | 81 |
82 | 85 | 86 |
87 |
88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /docs/namespaces.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Namespaces | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |
26 | 29 |
30 | 31 | 35 |
36 |
37 | 38 |
39 | 40 |
41 |
42 | 65 | 66 |
67 | 70 | 71 |
72 |
73 |

Qcloud

74 | 78 |
79 |
80 | 81 |
82 | 85 | 86 |
87 |
88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /demo/simple/app.php: -------------------------------------------------------------------------------- 1 | send(0, "86", $phoneNumbers[0], 36 | "【腾讯云】您的验证码是: 5678", "", ""); 37 | $rsp = json_decode($result); 38 | echo $result; 39 | } catch(\Exception $e) { 40 | echo var_dump($e); 41 | } 42 | echo "\n"; 43 | 44 | 45 | // 指定模板ID单发短信 46 | try { 47 | $ssender = new SmsSingleSender($appid, $appkey); 48 | $params = ["5678"]; 49 | $result = $ssender->sendWithParam("86", $phoneNumbers[0], $templateId, 50 | $params, $smsSign, "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信 51 | $rsp = json_decode($result); 52 | echo $result; 53 | } catch(\Exception $e) { 54 | echo var_dump($e); 55 | } 56 | echo "\n"; 57 | 58 | 59 | // 群发 60 | try { 61 | $msender = new SmsMultiSender($appid, $appkey); 62 | $result = $msender->send(0, "86", $phoneNumbers, 63 | "【腾讯云】您的验证码是: 5678", "", ""); 64 | $rsp = json_decode($result); 65 | echo $result; 66 | } catch(\Exception $e) { 67 | echo var_dump($e); 68 | } 69 | echo "\n"; 70 | 71 | 72 | // 指定模板ID群发 73 | try { 74 | $msender = new SmsMultiSender($appid, $appkey); 75 | $params = ["5678"]; 76 | $result = $msender->sendWithParam("86", $phoneNumbers, 77 | $templateId, $params, $smsSign, "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信 78 | $rsp = json_decode($result); 79 | echo $result; 80 | } catch(\Exception $e) { 81 | echo var_dump($e); 82 | } 83 | echo "\n"; 84 | 85 | 86 | // 发送语音验证码 87 | try { 88 | $vvcsender = new SmsVoiceVerifyCodeSender($appid, $appkey); 89 | $result = $vvcsender->send("86", $phoneNumbers[0], "5678", 2, ""); 90 | $rsp = json_decode($result); 91 | echo $result; 92 | } catch (\Exception $e) { 93 | echo var_dump($e); 94 | } 95 | echo "\n"; 96 | 97 | 98 | // 发送语音通知 99 | try { 100 | $vpsender = new SmsVoicePromptSender($appid, $appkey); 101 | $result = $vpsender->send("86", $phoneNumbers[0], 2, "5678", ""); 102 | $rsp = json_decode($result); 103 | echo $result; 104 | } catch (\Exception $e) { 105 | echo var_dump($e); 106 | } 107 | echo "\n"; 108 | 109 | 110 | // 拉取短信回执以及回复 111 | try { 112 | $sspuller = new SmsStatusPuller($appid, $appkey); 113 | 114 | // 拉取短信回执 115 | $callbackResult = $sspuller->pullCallback(10); 116 | $callbackRsp = json_decode($callbackResult); 117 | echo $callbackResult; 118 | 119 | // 拉取回复 120 | $replyResult = $spuller->pullReply(10); 121 | $replyRsp = json_decode($replyResult); 122 | echo $replyResult; 123 | } catch (\Exception $e) { 124 | echo var_dump($e); 125 | } 126 | echo "\n"; 127 | 128 | 129 | // 拉取单个手机短信状态 130 | try { 131 | $beginTime = 1516670595; // 开始时间(unix timestamp) 132 | $endTime = 1516680595; // 结束时间(unix timestamp) 133 | $maxNum = 10; // 单次拉取最大量 134 | $mspuller = new SmsMobileStatusPuller($appid, $appkey); 135 | 136 | // 拉取短信回执 137 | $callbackResult = $mspuller->pullCallback("86", $phoneNumbers[0], 138 | $beginTime, $endTime, $maxNum); 139 | $callbackRsp = json_decode($callbackResult); 140 | echo $callbackResult; 141 | echo "\n"; 142 | 143 | // 拉取回复 144 | $replyResult = $mspuller->pullReply("86", $phoneNumbers[0], 145 | $beginTime, $endTime, $maxNum); 146 | $replyRsp = json_decode($replyResult); 147 | echo $replyResult; 148 | } catch (\Exception $e) { 149 | echo var_dump($e); 150 | } 151 | echo "\n"; 152 | 153 | 154 | // 上传语音文件 155 | try { 156 | $filepath = "path/to/example.mp3"; 157 | $fileContent = file_get_contents($filepath); 158 | if ($fileContent == false) { 159 | throw new \Exception("can not read file " . $filepath); 160 | } 161 | 162 | $contentType = VoiceFileUploader::MP3; 163 | $uploader = new VoiceFileUploader($appid, $appkey); 164 | $result = $uploader->upload($fileContent, $contentType); 165 | $rsp = json_decode($result); 166 | echo $result; 167 | } catch (\Exception $e) { 168 | echo var_dump($e); 169 | } 170 | echo "\n"; 171 | 172 | 173 | // 按语音文件fid发送语音通知 174 | try { 175 | $fid = "73844bb649ca38f37e596ec2781ce6a56a2a3a1b.mp3"; 176 | 177 | $fvsender = new FileVoiceSender($appid, $appkey); 178 | $result = $fvsender->send("86", $phoneNumbers[0], $fid); 179 | 180 | $rsp = json_decode($result); 181 | echo $result; 182 | } catch (\Exception $e) { 183 | echo var_dump($e); 184 | } 185 | echo "\n"; 186 | 187 | 188 | // 指定模板发送语音通知类 189 | try { 190 | $templateId = 1013; 191 | $params = ["54321"]; 192 | 193 | $tvsender = new TtsVoiceSender($appid, $appkey); 194 | $result = $tvsender->send("86", $phoneNumbers[0], $templateId, $params); 195 | 196 | $rsp = json_decode($result); 197 | echo $result; 198 | } catch (\Exception $e) { 199 | echo var_dump($e); 200 | } 201 | echo "\n"; -------------------------------------------------------------------------------- /demo/composer/app.php: -------------------------------------------------------------------------------- 1 | send(0, "86", $phoneNumbers[0], 37 | "【腾讯云】您的验证码是: 5678", "", ""); 38 | $rsp = json_decode($result); 39 | echo $result; 40 | } catch(\Exception $e) { 41 | echo var_dump($e); 42 | } 43 | echo "\n"; 44 | 45 | 46 | // 指定模板ID单发短信 47 | try { 48 | $ssender = new SmsSingleSender($appid, $appkey); 49 | $params = ["5678"]; 50 | $result = $ssender->sendWithParam("86", $phoneNumbers[0], $templateId, 51 | $params, $smsSign, "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信 52 | $rsp = json_decode($result); 53 | echo $result; 54 | } catch(\Exception $e) { 55 | echo var_dump($e); 56 | } 57 | echo "\n"; 58 | 59 | 60 | // 群发 61 | try { 62 | $msender = new SmsMultiSender($appid, $appkey); 63 | $result = $msender->send(0, "86", $phoneNumbers, 64 | "【腾讯云】您的验证码是: 5678", "", ""); 65 | $rsp = json_decode($result); 66 | echo $result; 67 | } catch(\Exception $e) { 68 | echo var_dump($e); 69 | } 70 | echo "\n"; 71 | 72 | 73 | // 指定模板ID群发 74 | try { 75 | $msender = new SmsMultiSender($appid, $appkey); 76 | $params = ["5678"]; 77 | $result = $msender->sendWithParam("86", $phoneNumbers, 78 | $templateId, $params, $smsSign, "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信 79 | $rsp = json_decode($result); 80 | echo $result; 81 | } catch(\Exception $e) { 82 | echo var_dump($e); 83 | } 84 | echo "\n"; 85 | 86 | 87 | // 发送语音验证码 88 | try { 89 | $vvcsender = new SmsVoiceVerifyCodeSender($appid, $appkey); 90 | $result = $vvcsender->send("86", $phoneNumbers[0], "5678", 2, ""); 91 | $rsp = json_decode($result); 92 | echo $result; 93 | } catch (\Exception $e) { 94 | echo var_dump($e); 95 | } 96 | echo "\n"; 97 | 98 | 99 | // 发送语音通知 100 | try { 101 | $vpsender = new SmsVoicePromptSender($appid, $appkey); 102 | $result = $vpsender->send("86", $phoneNumbers[0], 2, "5678", ""); 103 | $rsp = json_decode($result); 104 | echo $result; 105 | } catch (\Exception $e) { 106 | echo var_dump($e); 107 | } 108 | echo "\n"; 109 | 110 | 111 | // 拉取短信回执以及回复 112 | try { 113 | $sspuller = new SmsStatusPuller($appid, $appkey); 114 | 115 | // 拉取短信回执 116 | $callbackResult = $sspuller->pullCallback(10); 117 | $callbackRsp = json_decode($callbackResult); 118 | echo $callbackResult; 119 | 120 | // 拉取回复 121 | $replyResult = $spuller->pullReply(10); 122 | $replyRsp = json_decode($replyResult); 123 | echo $replyResult; 124 | } catch (\Exception $e) { 125 | echo var_dump($e); 126 | } 127 | echo "\n"; 128 | 129 | 130 | // 拉取单个手机短信状态 131 | try { 132 | $beginTime = 1516670595; // 开始时间(unix timestamp) 133 | $endTime = 1516680595; // 结束时间(unix timestamp) 134 | $maxNum = 10; // 单次拉取最大量 135 | $mspuller = new SmsMobileStatusPuller($appid, $appkey); 136 | 137 | // 拉取短信回执 138 | $callbackResult = $mspuller->pullCallback("86", $phoneNumbers[0], 139 | $beginTime, $endTime, $maxNum); 140 | $callbackRsp = json_decode($callbackResult); 141 | echo $callbackResult; 142 | echo "\n"; 143 | 144 | // 拉取回复 145 | $replyResult = $mspuller->pullReply("86", $phoneNumbers[0], 146 | $beginTime, $endTime, $maxNum); 147 | $replyRsp = json_decode($replyResult); 148 | echo $replyResult; 149 | } catch (\Exception $e) { 150 | echo var_dump($e); 151 | } 152 | echo "\n"; 153 | 154 | 155 | // 上传语音文件 156 | try { 157 | $filepath = "path/to/example.mp3"; 158 | $fileContent = file_get_contents($filepath); 159 | if ($fileContent == false) { 160 | throw new \Exception("can not read file " . $filepath); 161 | } 162 | 163 | $contentType = VoiceFileUploader::MP3; 164 | $uploader = new VoiceFileUploader($appid, $appkey); 165 | $result = $uploader->upload($fileContent, $contentType); 166 | $rsp = json_decode($result); 167 | echo $result; 168 | } catch (\Exception $e) { 169 | echo var_dump($e); 170 | } 171 | echo "\n"; 172 | 173 | 174 | // 按语音文件fid发送语音通知 175 | try { 176 | $fid = "73844bb649ca38f37e596ec2781ce6a56a2a3a1b.mp3"; 177 | 178 | $fvsender = new FileVoiceSender($appid, $appkey); 179 | $result = $fvsender->send("86", $phoneNumbers[0], $fid); 180 | 181 | $rsp = json_decode($result); 182 | echo $result; 183 | } catch (\Exception $e) { 184 | echo var_dump($e); 185 | } 186 | echo "\n"; 187 | 188 | 189 | // 指定模板发送语音通知类 190 | try { 191 | $templateId = 1013; 192 | $params = ["54321"]; 193 | 194 | $tvsender = new TtsVoiceSender($appid, $appkey); 195 | $result = $tvsender->send("86", $phoneNumbers[0], $templateId, $params); 196 | 197 | $rsp = json_decode($result); 198 | echo $result; 199 | } catch (\Exception $e) { 200 | echo var_dump($e); 201 | } 202 | echo "\n"; 203 | -------------------------------------------------------------------------------- /docs/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Search | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |
26 | 29 |
30 | 31 | 35 |
36 |
37 | 38 |
39 | 40 |
41 |
42 | 65 | 66 |
67 | 68 | 71 | 72 |

This page allows you to search through the API documentation for 73 | specific terms. Enter your search words into the box below and click 74 | "submit". The search will be performed on namespaces, classes, interfaces, 75 | traits, functions, and methods.

76 | 77 |
78 |
79 | 80 | 81 |
82 | 83 |
84 | 85 |

Search Results

86 | 87 |
88 |
    89 |
    90 | 91 | 143 | 144 | 145 |
    146 | 149 | 150 |
    151 |
    152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /src/SmsSenderUtil.php: -------------------------------------------------------------------------------- 1 | nationcode = $nationCode; 70 | $telElement->mobile = $phoneNumbers[$i]; 71 | array_push($tel, $telElement); 72 | } while (++$i < count($phoneNumbers)); 73 | 74 | return $tel; 75 | } 76 | 77 | /** 78 | * 生成签名 79 | * 80 | * @param string $appkey sdkappid对应的appkey 81 | * @param string $random 随机正整数 82 | * @param string $curTime 当前时间 83 | * @param array $phoneNumber 手机号码 84 | * @return string 签名结果 85 | */ 86 | public function calculateSigForTempl($appkey, $random, $curTime, $phoneNumber) 87 | { 88 | $phoneNumbers = array($phoneNumber); 89 | 90 | return $this->calculateSigForTemplAndPhoneNumbers($appkey, $random, 91 | $curTime, $phoneNumbers); 92 | } 93 | 94 | /** 95 | * 生成签名 96 | * 97 | * @param string $appkey sdkappid对应的appkey 98 | * @param string $random 随机正整数 99 | * @param string $curTime 当前时间 100 | * @return string 签名结果 101 | */ 102 | public function calculateSigForPuller($appkey, $random, $curTime) 103 | { 104 | return hash("sha256", "appkey=".$appkey."&random=".$random 105 | ."&time=".$curTime); 106 | } 107 | 108 | /** 109 | * 生成上传文件授权 110 | * 111 | * @param string $appkey sdkappid对应的appkey 112 | * @param string $random 随机正整数 113 | * @param string $curTime 当前时间 114 | * @param array $fileSha1Sum 文件sha1sum 115 | * @return string 授权结果 116 | */ 117 | public function calculateAuth($appkey, $random, $curTime, $fileSha1Sum) 118 | { 119 | return hash("sha256", "appkey=".$appkey."&random=".$random 120 | ."&time=".$curTime."&content-sha1=".$fileSha1Sum); 121 | } 122 | 123 | /** 124 | * 生成sha1sum 125 | * 126 | * @param string $content 内容 127 | * @return string 内容sha1散列值 128 | */ 129 | public function sha1sum($content) 130 | { 131 | return hash("sha1", $content); 132 | } 133 | 134 | /** 135 | * 发送请求 136 | * 137 | * @param string $url 请求地址 138 | * @param array $dataObj 请求内容 139 | * @return string 应答json字符串 140 | */ 141 | public function sendCurlPost($url, $dataObj) 142 | { 143 | $curl = curl_init(); 144 | curl_setopt($curl, CURLOPT_URL, $url); 145 | curl_setopt($curl, CURLOPT_HEADER, 0); 146 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 147 | curl_setopt($curl, CURLOPT_POST, 1); 148 | curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); 149 | curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($dataObj)); 150 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 151 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); 152 | 153 | $ret = curl_exec($curl); 154 | if (false == $ret) { 155 | // curl_exec failed 156 | $result = "{ \"result\":" . -2 . ",\"errmsg\":\"" . curl_error($curl) . "\"}"; 157 | } else { 158 | $rsp = curl_getinfo($curl, CURLINFO_HTTP_CODE); 159 | if (200 != $rsp) { 160 | $result = "{ \"result\":" . -1 . ",\"errmsg\":\"". $rsp 161 | . " " . curl_error($curl) ."\"}"; 162 | } else { 163 | $result = $ret; 164 | } 165 | } 166 | 167 | curl_close($curl); 168 | 169 | return $result; 170 | } 171 | 172 | /** 173 | * 发送请求 174 | * 175 | * @param string $req 请求对象 176 | * @return string 应答json字符串 177 | */ 178 | public function fetch($req) 179 | { 180 | $curl = curl_init(); 181 | 182 | curl_setopt($curl, CURLOPT_URL, $req->url); 183 | curl_setopt($curl, CURLOPT_HTTPHEADER, $req->headers); 184 | curl_setopt($curl, CURLOPT_POSTFIELDS, $req->body); 185 | curl_setopt($curl, CURLOPT_HEADER, 0); 186 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 187 | curl_setopt($curl, CURLOPT_POST, 1); 188 | curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); 189 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 190 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); 191 | 192 | $result = curl_exec($curl); 193 | 194 | if (false == $result) { 195 | // curl_exec failed 196 | $result = "{ \"result\":" . -2 . ",\"errmsg\":\"" . curl_error($curl) . "\"}"; 197 | } else { 198 | $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); 199 | if (200 != $code) { 200 | $result = "{ \"result\":" . -1 . ",\"errmsg\":\"". $code 201 | . " " . curl_error($curl) ."\"}"; 202 | } 203 | } 204 | curl_close($curl); 205 | 206 | return $result; 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 腾讯云短信 PHP SDK 2 | === 3 | 4 | ## 腾讯短信服务 5 | 6 | 目前`腾讯云短信`为客户提供`国内短信`、`国内语音`和`海外短信`三大服务,腾讯云短信SDK支持以下操作: 7 | 8 | ### 国内短信 9 | 10 | 国内短信支持操作: 11 | 12 | - 指定模板单发短信 13 | - 指定模板群发短信 14 | - 拉取短信回执和短信回复状态 15 | 16 | > `Note` 短信拉取功能需要联系腾讯云短信技术支持(QQ:3012203387)开通权限,量大客户可以使用此功能批量拉取,其他客户不建议使用。 17 | 18 | ### 海外短信 19 | 20 | 海外短信支持操作: 21 | 22 | - 指定模板单发短信 23 | - 指定模板群发短信 24 | - 拉取短信回执和短信回复状态 25 | 26 | > `Note` 海外短信和国内短信使用同一接口,只需替换相应的国家码与手机号码,每次请求群发接口手机号码需全部为国内或者海外手机号码。 27 | 28 | ### 语音通知 29 | 30 | 语音通知支持操作: 31 | 32 | - 发送语音验证码 33 | - 发送语音通知 34 | - 上传语音文件 35 | - 按语音文件fid发送语音通知 36 | - 指定模板发送语音通知类 37 | 38 | ## 开发 39 | 40 | ### 准备 41 | 42 | 在开始开发云短信应用之前,需要准备如下信息: 43 | 44 | - [x] 获取SDK AppID和AppKey 45 | 46 | 云短信应用SDK `AppID`和`AppKey`可在[短信控制台](https://console.cloud.tencent.com/sms)的应用信息里获取,如您尚未添加应用,请到[短信控制台](https://console.cloud.tencent.com/sms)中添加应用。 47 | 48 | - [x] 申请签名 49 | 50 | 一个完整的短信由短信`签名`和短信正文内容两部分组成,短信`签名`须申请和审核,`签名`可在[短信控制台](https://console.cloud.tencent.com/sms)的相应服务模块`内容配置`中进行申请。 51 | 52 | - [x] 申请模板 53 | 54 | 同样短信或语音正文内容`模板`须申请和审核,`模板`可在[短信控制台](https://console.cloud.tencent.com/sms)的相应服务模块`内容配置`中进行申请。 55 | 56 | ## 安装 57 | 58 | ### Composer 59 | 60 | qcloudsms_php采用composer进行安装,要使用qcloudsms功能,只需要在composer.json中添加如下依赖: 61 | 62 | ```json 63 | { 64 | "require": { 65 | "qcloudsms/qcloudsms_php": "0.1.*" 66 | } 67 | } 68 | ``` 69 | 70 | > `Note` Composer的使用可以参考demo目录下面的示例。 71 | 72 | ### 手动 73 | 74 | 1. 手动下载或clone最新版本qcloudsms_php代码 75 | 2. 把qcloudsms_php放入项目目录 76 | 3. `require` qcloudsms_php src目录下面的index.php,即可使用,如把qcloudsms放在当前目录下,只需要: 77 | 78 | ```php 79 | require __DIR__ . "/qcloudsms_php/src/index.php"; 80 | ``` 81 | 82 | ## 用法 83 | 84 | 若您对接口存在疑问,可以查阅 [API文档](https://cloud.tencent.com/document/product/382/13297) 、[SDK文档](https://qcloudsms.github.io/qcloudsms_php/) 和 [错误码](https://cloud.tencent.com/document/product/382/3771)。 85 | 86 | - **准备必要参数** 87 | 88 | ```php 89 | // 短信应用SDK AppID 90 | $appid = 1400009099; // 1400开头 91 | 92 | // 短信应用SDK AppKey 93 | $appkey = "9ff91d87c2cd7cd0ea762f141975d1df37481d48700d70ac37470aefc60f9bad"; 94 | 95 | // 需要发送短信的手机号码 96 | $phoneNumbers = ["21212313123", "12345678902", "12345678903"]; 97 | 98 | // 短信模板ID,需要在短信应用中申请 99 | $templateId = 7839; // NOTE: 这里的模板ID`7839`只是一个示例,真实的模板ID需要在短信控制台中申请 100 | 101 | $smsSign = "腾讯云"; // NOTE: 这里的签名只是示例,请使用真实的已申请的签名,签名参数使用的是`签名内容`,而不是`签名ID` 102 | ``` 103 | 104 | - **指定模板ID单发短信** 105 | 106 | ```php 107 | use Qcloud\Sms\SmsSingleSender; 108 | 109 | try { 110 | $ssender = new SmsSingleSender($appid, $appkey); 111 | $params = ["5678"]; 112 | $result = $ssender->sendWithParam("86", $phoneNumbers[0], $templateId, 113 | $params, $smsSign, "", ""); // 签名参数不能为空串 114 | $rsp = json_decode($result); 115 | echo $result; 116 | } catch(\Exception $e) { 117 | echo var_dump($e); 118 | } 119 | ``` 120 | 121 | > `Note` 无论单发/群发短信还是指定模板ID单发/群发短信都需要从控制台中申请模板并且模板已经审核通过,才可能下发成功,否则返回失败。 122 | 123 | - **指定模板ID群发** 124 | 125 | ```php 126 | use Qcloud\Sms\SmsMultiSender; 127 | 128 | try { 129 | $msender = new SmsMultiSender($appid, $appkey); 130 | $params = ["5678"]; 131 | $result = $msender->sendWithParam("86", $phoneNumbers, 132 | $templateId, $params, $smsSign, "", ""); // 签名参数不能为空串 133 | $rsp = json_decode($result); 134 | echo $result; 135 | } catch(\Exception $e) { 136 | echo var_dump($e); 137 | } 138 | ``` 139 | 140 | > `Note` 群发一次请求最多支持200个号码,如有对号码数量有特殊需求请联系腾讯云短信技术支持(QQ:3012203387)。 141 | > `Note` 无论单发/群发短信还是指定模板ID单发/群发短信都需要从控制台中申请模板并且模板已经审核通过,才可能下发成功,否则返回失败。 142 | 143 | - **发送语音验证码** 144 | 145 | ```php 146 | use Qcloud\Sms\SmsVoiceVerifyCodeSender; 147 | 148 | try { 149 | $vvcsender = new SmsVoiceVerifyCodeSender($appid, $appkey); 150 | $result = $vvcsender->send("86", $phoneNumbers[0], "5678"); 151 | $rsp = json_decode($result); 152 | echo $result; 153 | } catch (\Exception $e) { 154 | echo var_dump($e); 155 | } 156 | ``` 157 | 158 | > `Note` 语音验证码发送只需提供验证码数字,例如当msg=“5678”时,您收到的语音通知为“您的语音验证码是5678”,如需自定义内容,可以使用语音通知。 159 | 160 | - **发送语音通知** 161 | 162 | ```php 163 | use Qcloud\Sms\SmsVoicePromptSender; 164 | 165 | try { 166 | $vpsender = new SmsVoicePromptSender($appid, $appkey); 167 | $result = $vpsender->send("86", $phoneNumbers[0], 2, "5678"); 168 | $rsp = json_decode($result); 169 | echo $result; 170 | } catch (\Exception $e) { 171 | echo var_dump($e); 172 | } 173 | ``` 174 | 175 | - **拉取短信回执以及回复** 176 | 177 | ```php 178 | use Qcloud\Sms\SmsStatusPuller; 179 | 180 | try { 181 | $sspuller = new SmsStatusPuller($appid, $appkey); 182 | 183 | // 拉取短信回执 184 | $callbackResult = $spuller->pullCallback(10); 185 | $callbackRsp = json_decode($callbackResult); 186 | echo $callbackResult; 187 | 188 | // 拉取回复 189 | $replyResult = $spuller->pullReply(10); 190 | $replyRsp = json_decode($replyResult); 191 | echo $replyResult; 192 | } catch (\Exception $e) { 193 | echo var_dump($e); 194 | } 195 | ``` 196 | 197 | > `Note` 短信拉取功能需要联系腾讯云短信技术支持(QQ:3012203387),量大客户可以使用此功能批量拉取,其他客户不建议使用。 198 | 199 | - **拉取单个手机短信状态** 200 | 201 | ```php 202 | use Qcloud\Sms\SmsMobileStatusPuller; 203 | 204 | try { 205 | $beginTime = 1511125600; // 开始时间(unix timestamp) 206 | $endTime = 1511841600; // 结束时间(unix timestamp) 207 | $maxNum = 10; // 单次拉取最大量 208 | $mspuller = new SmsMobileStatusPuller($appid, $appkey); 209 | 210 | // 拉取短信回执 211 | $callbackResult = $mspuller->pullCallback("86", $phoneNumbers[0], 212 | $beginTime, $endTime, $maxNum); 213 | $callbackRsp = json_decode($callbackResult); 214 | echo $callbackResult; 215 | 216 | // 拉取回复 217 | $replyResult = $mspuller->pullReply("86", $phoneNumbers[0], 218 | $beginTime, $endTime, $maxNum); 219 | $replyRsp = json_decode($replyResult); 220 | echo $replyResult; 221 | } catch (\Exception $e) { 222 | echo var_dump($e); 223 | } 224 | ``` 225 | 226 | > `Note` 短信拉取功能需要联系腾讯云短信技术支持(QQ:3012203387),量大客户可以使用此功能批量拉取,其他客户不建议使用。 227 | 228 | - **发送海外短信** 229 | 230 | 海外短信与国内短信发送类似, 发送海外短信只需替换相应国家码。 231 | 232 | 233 | 234 | - **上传语音文件** 235 | 236 | ```php 237 | use Qcloud\Sms\VoiceFileUploader; 238 | 239 | try { 240 | // Note: 语音文件大小上传限制400K字节 241 | $filepath = "path/to/example.mp3"; 242 | $fileContent = file_get_contents($filepath); 243 | if ($fileContent == false) { 244 | throw new \Exception("can not read file " . $filepath); 245 | } 246 | 247 | $contentType = VoiceFileUploader::MP3; 248 | $uploader = new VoiceFileUploader($appid, $appkey); 249 | $result = $uploader->upload($fileContent, $contentType); 250 | // 上传成功后,$rsp里会带有语音文件的fid 251 | $rsp = json_decode($result); 252 | echo $result; 253 | } catch (\Exception $e) { 254 | echo var_dump($e); 255 | } 256 | ``` 257 | 258 | > `Note` '语音文件上传'功能需要联系腾讯云短信技术支持(QQ:3012203387)才能开通 259 | 260 | 261 | - **按语音文件fid发送语音通知** 262 | 263 | ```php 264 | use Qcloud\Sms\FileVoiceSender; 265 | 266 | try { 267 | // Note:这里$fid来自`上传语音文件`接口返回的响应,要按语音 268 | // 文件fid发送语音通知,需要先上传语音文件获取$fid 269 | $fid = "73844bb649ca38f37e596ec2781ce6a56a2a3a1b.mp3"; 270 | $fvsender = new FileVoiceSender($appid, $appkey); 271 | $result = $fvsender->send("86", $phoneNumbers[0], $fid); 272 | $rsp = json_decode($result); 273 | echo $result; 274 | } catch (\Exception $e) { 275 | echo var_dump($e); 276 | } 277 | ``` 278 | 279 | > `Note` 按'语音文件fid发送语音通知'功能需要联系腾讯云短信技术支持(QQ:3012203387)才能开通 280 | 281 | 282 | - **指定模板发送语音通知** 283 | 284 | ```php 285 | use Qcloud\Sms\TtsVoiceSender; 286 | 287 | try { 288 | $templateId = 1013; 289 | $params = ["54321"]; 290 | $tvsender = new TtsVoiceSender($appid, $appkey); 291 | $result = $tvsender->send("86", $phoneNumbers[0], $templateId, $params); 292 | $rsp = json_decode($result); 293 | echo $result; 294 | } catch (\Exception $e) { 295 | echo var_dump($e); 296 | } 297 | ``` 298 | -------------------------------------------------------------------------------- /docs/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 70 | 71 | 72 |
    73 |
    74 |
    75 | FileVoiceSender 76 | 77 |
    78 |
    79 | 按语音文件fid发送语音通知类 80 |
    81 |
    82 |
    83 |
    84 | SmsMobileStatusPuller 85 | 86 |
    87 |
    88 | 拉取单个手机短信状态类 89 |
    90 |
    91 |
    92 |
    93 | SmsMultiSender 94 | 95 |
    96 |
    97 | 群发短信类 98 |
    99 |
    100 |
    101 |
    102 | SmsSenderUtil 103 | 104 |
    105 |
    106 | 发送Util类 107 |
    108 |
    109 |
    110 |
    111 | SmsSingleSender 112 | 113 |
    114 |
    115 | 单发短信类 116 |
    117 |
    118 |
    119 |
    120 | SmsStatusPuller 121 | 122 |
    123 |
    124 | 拉取短信状态类 125 |
    126 |
    127 |
    128 |
    129 | SmsVoicePromptSender 130 | 131 |
    132 |
    133 | 发送语音通知类 134 |
    135 |
    136 |
    137 |
    138 | SmsVoiceVerifyCodeSender 139 | 140 |
    141 |
    142 | 发送语音验证码类 143 |
    144 |
    145 |
    146 |
    147 | TtsVoiceSender 148 | 149 |
    150 |
    151 | 指定模板发送语音通知类 152 |
    153 |
    154 |
    155 |
    156 | VoiceFileUploader 157 | 158 |
    159 |
    160 | 上传语音文件类 161 |
    162 |
    163 |
    164 |
    165 | 168 | 169 |
    170 |
    171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 77 | 78 | 79 |

    Classes

    80 | 81 |
    82 |
    83 |
    84 | FileVoiceSender 85 | 86 |
    87 |
    88 | 按语音文件fid发送语音通知类 89 |
    90 |
    91 |
    92 |
    93 | SmsMobileStatusPuller 94 | 95 |
    96 |
    97 | 拉取单个手机短信状态类 98 |
    99 |
    100 |
    101 |
    102 | SmsMultiSender 103 | 104 |
    105 |
    106 | 群发短信类 107 |
    108 |
    109 |
    110 |
    111 | SmsSenderUtil 112 | 113 |
    114 |
    115 | 发送Util类 116 |
    117 |
    118 |
    119 |
    120 | SmsSingleSender 121 | 122 |
    123 |
    124 | 单发短信类 125 |
    126 |
    127 |
    128 |
    129 | SmsStatusPuller 130 | 131 |
    132 |
    133 | 拉取短信状态类 134 |
    135 |
    136 |
    137 |
    138 | SmsVoicePromptSender 139 | 140 |
    141 |
    142 | 发送语音通知类 143 |
    144 |
    145 |
    146 |
    147 | SmsVoiceVerifyCodeSender 148 | 149 |
    150 |
    151 | 发送语音验证码类 152 |
    153 |
    154 |
    155 |
    156 | TtsVoiceSender 157 | 158 |
    159 |
    160 | 指定模板发送语音通知类 161 |
    162 |
    163 |
    164 |
    165 | VoiceFileUploader 166 | 167 |
    168 |
    169 | 上传语音文件类 170 |
    171 |
    172 |
    173 | 174 | 175 | 176 |
    177 | 180 | 181 |
    182 |
    183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/VoiceFileUploader.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\VoiceFileUploader | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | VoiceFileUploader 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    上传语音文件类

    90 | 91 | 92 |

    Constants

    93 | 94 | 95 | 96 | 97 | 101 | 102 | 103 | 104 | 108 | 109 |
    WAV 98 |

    99 |

    100 |
    MP3 105 |

    106 |

    107 |
    110 | 111 | 112 | 113 |

    Methods

    114 | 115 |
    116 |
    117 |
    118 | 119 |
    120 |
    121 | __construct(string $appid, string $appkey) 122 | 123 |

    构造函数

    124 |
    125 |
    126 |
    127 |
    128 | string 129 |
    130 |
    131 | upload(string $fileContent, string $contentType) 132 | 133 |

    上传语音文件

    134 |
    135 |
    136 |
    137 | 138 | 139 |

    Details

    140 | 141 |
    142 |
    143 |

    144 |
    at line 28
    145 | 146 | __construct(string $appid, string $appkey) 147 | 148 |

    149 |
    150 | 151 | 152 | 153 |
    154 |

    构造函数

    155 |
    156 |

    Parameters

    157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    170 | 171 | 172 | 173 | 174 |
    175 |
    176 | 177 |
    178 |
    179 |

    180 |
    at line 44
    181 | string 182 | upload(string $fileContent, string $contentType) 183 | 184 |

    185 |
    186 | 187 | 188 | 189 |
    190 |

    上传语音文件

    191 |
    192 |

    Parameters

    193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 |
    string$fileContent语音文件内容
    string$contentType语音文件类型,目前支持 VoiceFileUploader::WAV 和 VoiceFileUploader::MP3
    206 | 207 | 208 |

    Return Value

    209 | 210 | 211 | 212 | 213 | 214 | 215 |
    string应答json字符串,详细内容参见腾讯云协议文档
    216 | 217 | 218 | 219 |
    220 |
    221 | 222 |
    223 |
    224 | 225 | 226 |
    227 | 230 | 231 |
    232 |
    233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/FileVoiceSender.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\FileVoiceSender | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | FileVoiceSender 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    按语音文件fid发送语音通知类

    90 | 91 | 92 | 93 | 94 |

    Methods

    95 | 96 |
    97 |
    98 |
    99 | 100 |
    101 |
    102 | __construct(string $appid, string $appkey) 103 | 104 |

    构造函数

    105 |
    106 |
    107 |
    108 |
    109 | string 110 |
    111 |
    112 | send(string $nationCode, string $phoneNumber, string $fid, string $playtimes = 2, string $ext = "") 113 | 114 |

    按语音文件fid发送语音通知

    115 |
    116 |
    117 |
    118 | 119 | 120 |

    Details

    121 | 122 |
    123 |
    124 |

    125 |
    at line 25
    126 | 127 | __construct(string $appid, string $appkey) 128 | 129 |

    130 |
    131 | 132 | 133 | 134 |
    135 |

    构造函数

    136 |
    137 |

    Parameters

    138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    151 | 152 | 153 | 154 | 155 |
    156 |
    157 | 158 |
    159 |
    160 |

    161 |
    at line 44
    162 | string 163 | send(string $nationCode, string $phoneNumber, string $fid, string $playtimes = 2, string $ext = "") 164 | 165 |

    166 |
    167 | 168 | 169 | 170 |
    171 |

    按语音文件fid发送语音通知

    172 |
    173 |

    Parameters

    174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 |
    string$nationCode国家码,如 86 为中国
    string$phoneNumber不带国家码的手机号
    string$fid语音文件fid
    string$playtimes播放次数,可选,最多3次,默认2次
    string$ext用户的session内容,服务端原样返回,可选字段,不需要可填空串
    202 | 203 | 204 |

    Return Value

    205 | 206 | 207 | 208 | 209 | 210 | 211 |
    string应答json字符串,详细内容参见腾讯云协议文档
    212 | 213 | 214 | 215 |
    216 |
    217 | 218 |
    219 |
    220 | 221 | 222 |
    223 | 226 | 227 |
    228 |
    229 | 230 | 231 | 232 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/SmsVoiceVerifyCodeSender.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\SmsVoiceVerifyCodeSender | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | SmsVoiceVerifyCodeSender 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    发送语音验证码类

    90 | 91 | 92 | 93 | 94 |

    Methods

    95 | 96 |
    97 |
    98 |
    99 | 100 |
    101 |
    102 | __construct(string $appid, string $appkey) 103 | 104 |

    构造函数

    105 |
    106 |
    107 |
    108 |
    109 | string 110 |
    111 |
    112 | send(string $nationCode, string $phoneNumber, string $msg, int $playtimes = 2, string $ext = "") 113 | 114 |

    发送语音验证码

    115 |
    116 |
    117 |
    118 | 119 | 120 |

    Details

    121 | 122 |
    123 |
    124 |

    125 |
    at line 24
    126 | 127 | __construct(string $appid, string $appkey) 128 | 129 |

    130 |
    131 | 132 | 133 | 134 |
    135 |

    构造函数

    136 |
    137 |

    Parameters

    138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    151 | 152 | 153 | 154 | 155 |
    156 |
    157 | 158 |
    159 |
    160 |

    161 |
    at line 42
    162 | string 163 | send(string $nationCode, string $phoneNumber, string $msg, int $playtimes = 2, string $ext = "") 164 | 165 |

    166 |
    167 | 168 | 169 | 170 |
    171 |

    发送语音验证码

    172 |
    173 |

    Parameters

    174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 |
    string$nationCode国家码,如 86 为中国
    string$phoneNumber不带国家码的手机号
    string$msg信息内容,必须与申请的模板格式一致,否则将返回错误
    int$playtimes播放次数,可选,最多3次,默认2次
    string$ext用户的session内容,服务端原样返回,可选字段,不需要可填空串
    202 | 203 | 204 |

    Return Value

    205 | 206 | 207 | 208 | 209 | 210 | 211 |
    string应答json字符串,详细内容参见腾讯云协议文档
    212 | 213 | 214 | 215 |
    216 |
    217 | 218 |
    219 |
    220 | 221 | 222 |
    223 | 226 | 227 |
    228 |
    229 | 230 | 231 | 232 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/TtsVoiceSender.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\TtsVoiceSender | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | TtsVoiceSender 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    指定模板发送语音通知类

    90 | 91 | 92 | 93 | 94 |

    Methods

    95 | 96 |
    97 |
    98 |
    99 | 100 |
    101 |
    102 | __construct(string $appid, string $appkey) 103 | 104 |

    构造函数

    105 |
    106 |
    107 |
    108 |
    109 | string 110 |
    111 |
    112 | send(string $nationCode, string $phoneNumber, int $templId, array $params, string $playtimes = 2, string $ext = "") 113 | 114 |

    指定模板发送语音短信

    115 |
    116 |
    117 |
    118 | 119 | 120 |

    Details

    121 | 122 |
    123 |
    124 |

    125 |
    at line 25
    126 | 127 | __construct(string $appid, string $appkey) 128 | 129 |

    130 |
    131 | 132 | 133 | 134 |
    135 |

    构造函数

    136 |
    137 |

    Parameters

    138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    151 | 152 | 153 | 154 | 155 |
    156 |
    157 | 158 |
    159 |
    160 |

    161 |
    at line 45
    162 | string 163 | send(string $nationCode, string $phoneNumber, int $templId, array $params, string $playtimes = 2, string $ext = "") 164 | 165 |

    166 |
    167 | 168 | 169 | 170 |
    171 |

    指定模板发送语音短信

    172 |
    173 |

    Parameters

    174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 |
    string$nationCode国家码,如 86 为中国
    string$phoneNumber不带国家码的手机号
    int$templId模板 id
    array$params模板参数列表,如模板 {1}...{2}...{3},需要带三个参数
    string$playtimes播放次数,可选,最多3次,默认2次
    string$ext用户的session内容,服务端原样返回,可选字段,不需要可填空串
    207 | 208 | 209 |

    Return Value

    210 | 211 | 212 | 213 | 214 | 215 | 216 |
    string应答json字符串,详细内容参见腾讯云协议文档
    217 | 218 | 219 | 220 |
    221 |
    222 | 223 |
    224 |
    225 | 226 | 227 |
    228 | 231 | 232 |
    233 |
    234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/SmsVoicePromptSender.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\SmsVoicePromptSender | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | SmsVoicePromptSender 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    发送语音通知类

    90 | 91 | 92 | 93 | 94 |

    Methods

    95 | 96 |
    97 |
    98 |
    99 | 100 |
    101 |
    102 | __construct(string $appid, string $appkey) 103 | 104 |

    构造函数

    105 |
    106 |
    107 |
    108 |
    109 | string 110 |
    111 |
    112 | send(string $nationCode, string $phoneNumber, string $prompttype, string $msg, string $playtimes = 2, string $ext = "") 113 | 114 |

    发送语音通知

    115 |
    116 |
    117 |
    118 | 119 | 120 |

    Details

    121 | 122 |
    123 |
    124 |

    125 |
    at line 24
    126 | 127 | __construct(string $appid, string $appkey) 128 | 129 |

    130 |
    131 | 132 | 133 | 134 |
    135 |

    构造函数

    136 |
    137 |

    Parameters

    138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    151 | 152 | 153 | 154 | 155 |
    156 |
    157 | 158 |
    159 |
    160 |

    161 |
    at line 44
    162 | string 163 | send(string $nationCode, string $phoneNumber, string $prompttype, string $msg, string $playtimes = 2, string $ext = "") 164 | 165 |

    166 |
    167 | 168 | 169 | 170 |
    171 |

    发送语音通知

    172 |
    173 |

    Parameters

    174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 |
    string$nationCode国家码,如 86 为中国
    string$phoneNumber不带国家码的手机号
    string$prompttype语音类型,目前固定为2
    string$msg信息内容,必须与申请的模板格式一致,否则将返回错误
    string$playtimes播放次数,可选,最多3次,默认2次
    string$ext用户的session内容,服务端原样返回,可选字段,不需要可填空串
    207 | 208 | 209 |

    Return Value

    210 | 211 | 212 | 213 | 214 | 215 | 216 |
    string应答json字符串,详细内容参见腾讯云协议文档
    217 | 218 | 219 | 220 |
    221 |
    222 | 223 |
    224 |
    225 | 226 | 227 |
    228 | 231 | 232 |
    233 |
    234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /docs/css/sami.css: -------------------------------------------------------------------------------- 1 | html, body, #content { 2 | height: 100%; 3 | } 4 | 5 | /* Site menu */ 6 | 7 | #site-nav.navbar-default { 8 | margin: 0; 9 | border-radius: 0; 10 | border-bottom: 1px solid #ccc; 11 | background-color: #EDF3FE; 12 | background-image: none; 13 | } 14 | 15 | #site-nav.navbar-default .navbar-brand, 16 | #site-nav.navbar-default .navbar-nav > li > a { 17 | color: #000; 18 | } 19 | 20 | #site-nav.navbar-default .navbar-nav > li > a:hover { 21 | text-decoration: underline; 22 | } 23 | 24 | #navbar-elements { 25 | float: right; 26 | } 27 | 28 | @media (max-width: 768px) { 29 | #navbar-elements { 30 | float: none !important; 31 | } 32 | } 33 | 34 | /* Namespace breadcrumbs */ 35 | 36 | .namespace-breadcrumbs .breadcrumb { 37 | margin: 0 0 12px; 38 | border-radius: 0 0 4px 4px; 39 | padding-left: 35px; 40 | } 41 | 42 | .namespace-breadcrumbs .breadcrumb > li + li:before { 43 | content: ""; 44 | } 45 | .namespace-breadcrumbs .breadcrumb > .backslash { 46 | color: #ccc; 47 | } 48 | 49 | /* Site columns */ 50 | 51 | #right-column { 52 | margin-left: 20%; 53 | } 54 | 55 | #page-content { 56 | padding: 0 30px; 57 | } 58 | 59 | #left-column { 60 | width: 20%; 61 | position: fixed; 62 | height: 100%; 63 | border-right: 1px solid #ccc; 64 | line-height: 18px; 65 | font-size: 13px; 66 | display: flex; 67 | flex-flow: column; 68 | } 69 | 70 | @media (max-width: 991px) { 71 | #left-column { 72 | display: none; 73 | } 74 | #right-column { 75 | width: 100%; 76 | margin-left: 0; 77 | } 78 | } 79 | 80 | /* API Tree */ 81 | 82 | #api-tree { 83 | background: linear-gradient( 84 | to bottom, 85 | #FFF, 86 | #FFF 50%, 87 | #EDF3FE 50%, 88 | #EDF3FE 89 | ); 90 | background-size: 100% 56px; 91 | overflow: auto; 92 | height: 100%; 93 | background-attachment: local; 94 | } 95 | 96 | #api-tree ul { 97 | list-style-type: none; 98 | margin: 0; 99 | padding: 0; 100 | } 101 | 102 | #api-tree ul li { 103 | padding: 0; 104 | margin: 0; 105 | } 106 | 107 | /* Prevents the menu from jittering on lad */ 108 | #api-tree .glyphicon-play { 109 | width: 26px; 110 | } 111 | 112 | #api-tree ul li .hd { 113 | padding: 5px; 114 | } 115 | 116 | #api-tree li .hd:nth-child(even) { 117 | background-color: #EDF3FE; 118 | } 119 | 120 | #api-tree ul li.opened > .hd span { 121 | -webkit-transform: rotate(90deg); 122 | -moz-transform: rotate(90deg); 123 | -o-transform: rotate(90deg); 124 | -ms-transform: rotate(90deg); 125 | transform: rotate(90deg); 126 | } 127 | 128 | #api-tree .bd { 129 | display: none; 130 | } 131 | 132 | #api-tree li.opened > .bd { 133 | display: block; 134 | } 135 | 136 | #api-tree li .hd:hover { 137 | background-color: #eee; 138 | } 139 | 140 | #api-tree li.active > .hd { 141 | background-color: #3875D7; 142 | } 143 | 144 | #api-tree li.active > .hd a { 145 | color: #eee; 146 | font-weight: bold; 147 | } 148 | 149 | #api-tree a { 150 | color: #222; 151 | } 152 | 153 | #api-tree div.leaf a { 154 | margin-left: 20px; 155 | } 156 | 157 | #api-tree .hd span { 158 | padding: 2px 8px; 159 | font-size: 10px; 160 | line-height: 85%; 161 | } 162 | 163 | /* Control panel, search form, version drop-down */ 164 | 165 | #control-panel { 166 | background: #e8e8e8; 167 | border-bottom: 1px solid #666; 168 | padding: 4px; 169 | } 170 | 171 | #control-panel form { 172 | margin: 4px 4px 5px 4px; 173 | } 174 | 175 | #search-form { 176 | position: relative; 177 | } 178 | 179 | #search-form input { 180 | width: 100%; 181 | padding-left: 28px; 182 | } 183 | 184 | #search-form span.glyphicon-search { 185 | position: absolute; 186 | left: 9px; 187 | top: 9px; 188 | font-size: 14px; 189 | z-index: 2; 190 | } 191 | 192 | /* Typeahead */ 193 | 194 | .twitter-typeahead { 195 | width: 100%; 196 | z-index: 1; 197 | } 198 | 199 | .tt-dropdown-menu { 200 | overflow: auto; 201 | max-height: 260px; 202 | margin-top: 9px; 203 | background-color: #fff; 204 | border: 1px solid #ccc; 205 | border-radius: 8px; 206 | box-shadow: 0 5px 10px rgba(0,0,0,.2); 207 | padding: 8px; 208 | } 209 | 210 | .tt-dropdown-menu p { 211 | margin: 0; 212 | padding: 0; 213 | } 214 | 215 | .tt-suggestion { 216 | padding: 8px; 217 | border-bottom: 1px solid #ccc; 218 | font-size: 1.1em; 219 | } 220 | 221 | .tt-cursor { 222 | background-color: #3875D7; 223 | color: #fff; 224 | } 225 | 226 | /** General typography **/ 227 | 228 | .navbar { 229 | border-bottom: 0; 230 | } 231 | 232 | .page-header { 233 | margin: 0 0 20px; 234 | } 235 | 236 | abbr[title], abbr[data-original-title], abbr { 237 | border-bottom: none; 238 | cursor: pointer; 239 | } 240 | 241 | a abbr { 242 | cursor: pointer; 243 | } 244 | 245 | .method-description table, .description table { 246 | border: solid 1px #ccc; 247 | padding: 1em; 248 | margin: 1em; 249 | } 250 | 251 | .method-description td, .method-description th, 252 | .description td, .description th { 253 | padding: 0.75em 1.25em; 254 | } 255 | 256 | .method-description tbody tr:nth-child(even), 257 | .description tbody tr:nth-child(even) { 258 | background: #edf3fe; 259 | } 260 | 261 | .method-description tbody tr:nth-child(odd), 262 | .description tbody tr:nth-child(odd) { 263 | background: #fff; 264 | } 265 | 266 | .method-description thead tr, 267 | .description thead tr { 268 | background: #edf3fe; 269 | } 270 | 271 | /** General Sami styling **/ 272 | 273 | .underlined > .row { 274 | padding: 8px 0; 275 | border-bottom: 1px solid #ddd; 276 | } 277 | 278 | #footer { 279 | text-align: right; 280 | margin: 30px; 281 | font-size: 11px; 282 | } 283 | 284 | .description { 285 | margin: 10px 0; 286 | padding: 10px; 287 | background-color: #efefef; 288 | } 289 | 290 | .description p { 291 | padding: 0; 292 | margin: 8px 0; 293 | } 294 | 295 | .method-description { 296 | margin: 0 0 24px 0; 297 | } 298 | 299 | .details { 300 | padding-left: 30px; 301 | } 302 | 303 | #method-details .method-item { 304 | margin-bottom: 30px; 305 | } 306 | 307 | .method-item h3, 308 | .method-item h3 code { 309 | background-color: #eee; 310 | } 311 | 312 | .method-item h3 { 313 | padding: 4px; 314 | margin-bottom: 20px; 315 | font-size: 20px; 316 | } 317 | 318 | .location { 319 | font-size: 11px; 320 | float: right; 321 | font-style: italic; 322 | } 323 | 324 | .namespace-list a { 325 | padding: 3px 8px; 326 | margin: 0 5px 5px 0; 327 | border: 1px solid #ddd; 328 | background-color: #f9f9f9; 329 | display: inline-block; 330 | border-radius: 4px; 331 | } 332 | 333 | .no-description { 334 | color: #ccc; 335 | font-size: 90%; 336 | } 337 | 338 | /* Namespaces page */ 339 | 340 | .namespaces { 341 | clear: both; 342 | } 343 | 344 | .namespaces .namespace-container { 345 | float: left; 346 | margin: 0 14px 14px 0; 347 | min-width: 30%; 348 | } 349 | 350 | .namespaces h2 { 351 | margin: 0 0 20px 0; 352 | } 353 | 354 | @media (max-width: 991px) { 355 | .namespaces .namespace-container { 356 | margin-right: 0; 357 | width: 100%; 358 | } 359 | } 360 | 361 | /** Code and pre tags **/ 362 | 363 | tt, code, pre { 364 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; 365 | } 366 | 367 | code { 368 | padding: 0; 369 | padding-top: 0.2em; 370 | padding-bottom: 0.2em; 371 | margin: 0; 372 | font-size: 85%; 373 | background-color: rgba(0,0,0,0.04); 374 | border-radius: 3px; 375 | color: #333; 376 | } 377 | 378 | pre { 379 | padding: 16px; 380 | overflow: auto; 381 | font-size: 85%; 382 | line-height: 1.45; 383 | background-color: #f7f7f7; 384 | border-radius: 3px; 385 | } 386 | 387 | h2 { 388 | background-color: #EDF3FE; 389 | padding: 4px 4px 4px 8px; 390 | font-size: 25px; 391 | margin: 20px 0; 392 | } 393 | 394 | /** Doc index **/ 395 | 396 | dt { 397 | font-weight: normal; 398 | } 399 | 400 | dd { 401 | margin-left: 30px; 402 | line-height: 1.5em; 403 | } 404 | 405 | #doc-index h2 { 406 | font-weight: bold; 407 | margin: 30px 0; 408 | } 409 | 410 | #doc-index .pagination { 411 | margin: 0; 412 | } 413 | 414 | /* Search page */ 415 | 416 | .search-results { 417 | list-style-type: none; 418 | padding: 0; 419 | margin: 0; 420 | } 421 | 422 | .search-results li { 423 | list-style-type: none; 424 | margin: 0; 425 | padding: 14px 0; 426 | border-bottom: 1px solid #ccc; 427 | } 428 | 429 | .search-results h2 { 430 | background: none; 431 | margin: 0; 432 | padding: 0; 433 | font-size: 18px; 434 | } 435 | 436 | .search-results h2 a { 437 | float: left; 438 | display: block; 439 | margin: 0 0 4px 0; 440 | } 441 | 442 | .search-results .search-type { 443 | float: right; 444 | margin: 0 0 4px 0; 445 | } 446 | 447 | .search-results .search-from { 448 | margin: 0 0 12px 0; 449 | font-size: 12px; 450 | color: #999; 451 | } 452 | 453 | .search-results .search-from a { 454 | font-style: italic; 455 | } 456 | 457 | .search-results .search-description { 458 | margin: 8px 0 0 30px; 459 | } 460 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/SmsStatusPuller.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\SmsStatusPuller | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | SmsStatusPuller 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    拉取短信状态类

    90 | 91 | 92 | 93 | 94 |

    Methods

    95 | 96 |
    97 |
    98 |
    99 | 100 |
    101 |
    102 | __construct(string $appid, string $appkey) 103 | 104 |

    构造函数

    105 |
    106 |
    107 |
    108 |
    109 | string 110 |
    111 |
    112 | pullCallback(int $max) 113 | 114 |

    拉取回执结果

    115 |
    116 |
    117 |
    118 |
    119 | string 120 |
    121 |
    122 | pullReply(int $max) 123 | 124 |

    拉取回复信息

    125 |
    126 |
    127 |
    128 | 129 | 130 |

    Details

    131 | 132 |
    133 |
    134 |

    135 |
    at line 24
    136 | 137 | __construct(string $appid, string $appkey) 138 | 139 |

    140 |
    141 | 142 | 143 | 144 |
    145 |

    构造函数

    146 |
    147 |

    Parameters

    148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    161 | 162 | 163 | 164 | 165 |
    166 |
    167 | 168 |
    169 |
    170 |

    171 |
    at line 60
    172 | string 173 | pullCallback(int $max) 174 | 175 |

    176 |
    177 | 178 | 179 | 180 |
    181 |

    拉取回执结果

    182 |
    183 |

    Parameters

    184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 |
    int$max拉取最大条数,最多100
    192 | 193 | 194 |

    Return Value

    195 | 196 | 197 | 198 | 199 | 200 | 201 |
    string应答json字符串,详细内容参见腾讯云协议文档
    202 | 203 | 204 | 205 |
    206 |
    207 | 208 |
    209 |
    210 |

    211 |
    at line 71
    212 | string 213 | pullReply(int $max) 214 | 215 |

    216 |
    217 | 218 | 219 | 220 |
    221 |

    拉取回复信息

    222 |
    223 |

    Parameters

    224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 |
    int$max拉取最大条数,最多100
    232 | 233 | 234 |

    Return Value

    235 | 236 | 237 | 238 | 239 | 240 | 241 |
    string应答json字符串,详细内容参见腾讯云协议文档
    242 | 243 | 244 | 245 |
    246 |
    247 | 248 |
    249 |
    250 | 251 | 252 |
    253 | 256 | 257 |
    258 |
    259 | 260 | 261 | 262 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/SmsMobileStatusPuller.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\SmsMobileStatusPuller | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | SmsMobileStatusPuller 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    拉取单个手机短信状态类

    90 | 91 | 92 | 93 | 94 |

    Methods

    95 | 96 |
    97 |
    98 |
    99 | 100 |
    101 |
    102 | __construct(string $appid, string $appkey) 103 | 104 |

    构造函数

    105 |
    106 |
    107 |
    108 |
    109 | string 110 |
    111 |
    112 | pullCallback(string $nationCode, string $mobile, int $beginTime, int $endTime, int $max) 113 | 114 |

    拉取回执结果

    115 |
    116 |
    117 |
    118 |
    119 | string 120 |
    121 |
    122 | pullReply(string $nationCode, string $mobile, int $beginTime, int $endTime, int $max) 123 | 124 |

    拉取回复信息

    125 |
    126 |
    127 |
    128 | 129 | 130 |

    Details

    131 | 132 |
    133 |
    134 |

    135 |
    at line 24
    136 | 137 | __construct(string $appid, string $appkey) 138 | 139 |

    140 |
    141 | 142 | 143 | 144 |
    145 |

    构造函数

    146 |
    147 |

    Parameters

    148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    161 | 162 | 163 | 164 | 165 |
    166 |
    167 | 168 |
    169 |
    170 |

    171 |
    at line 72
    172 | string 173 | pullCallback(string $nationCode, string $mobile, int $beginTime, int $endTime, int $max) 174 | 175 |

    176 |
    177 | 178 | 179 | 180 |
    181 |

    拉取回执结果

    182 |
    183 |

    Parameters

    184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 |
    string$nationCode国家码,如 86 为中国
    string$mobile不带国家码的手机号
    int$beginTime开始时间(unix timestamp)
    int$endTime结束时间(unix timestamp)
    int$max拉取最大条数,最多100
    212 | 213 | 214 |

    Return Value

    215 | 216 | 217 | 218 | 219 | 220 | 221 |
    string应答json字符串,详细内容参见腾讯云协议文档
    222 | 223 | 224 | 225 |
    226 |
    227 | 228 |
    229 |
    230 |

    231 |
    at line 87
    232 | string 233 | pullReply(string $nationCode, string $mobile, int $beginTime, int $endTime, int $max) 234 | 235 |

    236 |
    237 | 238 | 239 | 240 |
    241 |

    拉取回复信息

    242 |
    243 |

    Parameters

    244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 |
    string$nationCode国家码,如 86 为中国
    string$mobile不带国家码的手机号
    int$beginTime开始时间(unix timestamp)
    int$endTime结束时间(unix timestamp)
    int$max拉取最大条数,最多100
    272 | 273 | 274 |

    Return Value

    275 | 276 | 277 | 278 | 279 | 280 | 281 |
    string应答json字符串,详细内容参见腾讯云协议文档
    282 | 283 | 284 | 285 |
    286 |
    287 | 288 |
    289 |
    290 | 291 | 292 |
    293 | 296 | 297 |
    298 |
    299 | 300 | 301 | 302 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/SmsMultiSender.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\SmsMultiSender | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | SmsMultiSender 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    群发短信类

    90 | 91 | 92 | 93 | 94 |

    Methods

    95 | 96 |
    97 |
    98 |
    99 | 100 |
    101 |
    102 | __construct(string $appid, string $appkey) 103 | 104 |

    构造函数

    105 |
    106 |
    107 |
    108 |
    109 | string 110 |
    111 |
    112 | send(int $type, string $nationCode, array $phoneNumbers, string $msg, string $extend = "", string $ext = "") 113 | 114 |

    普通群发

    115 |
    116 |
    117 |
    118 |
    119 | string 120 |
    121 |
    122 | sendWithParam(string $nationCode, array $phoneNumbers, int $templId, array $params, string $sign = "", string $extend = "", string $ext = "") 123 | 124 |

    指定模板群发

    125 |
    126 |
    127 |
    128 | 129 | 130 |

    Details

    131 | 132 |
    133 |
    134 |

    135 |
    at line 24
    136 | 137 | __construct(string $appid, string $appkey) 138 | 139 |

    140 |
    141 | 142 | 143 | 144 |
    145 |

    构造函数

    146 |
    147 |

    Parameters

    148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    161 | 162 | 163 | 164 | 165 |
    166 |
    167 | 168 |
    169 |
    170 |

    171 |
    at line 47
    172 | string 173 | send(int $type, string $nationCode, array $phoneNumbers, string $msg, string $extend = "", string $ext = "") 174 | 175 |

    176 |
    177 | 178 | 179 | 180 |
    181 |

    普通群发

    普通群发需明确指定内容,如果有多个签名,请在内容中以【】的方式添加到信息内容中, 182 | 否则系统将使用默认签名。

    183 |
    184 |

    Parameters

    185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 |
    int$type短信类型,0 为普通短信,1 营销短信
    string$nationCode国家码,如 86 为中国
    array$phoneNumbers不带国家码的手机号列表
    string$msg信息内容,必须与申请的模板格式一致,否则将返回错误
    string$extend扩展码,可填空串
    string$ext服务端原样返回的参数,可填空串
    218 | 219 | 220 |

    Return Value

    221 | 222 | 223 | 224 | 225 | 226 | 227 |
    string应答json字符串,详细内容参见腾讯云协议文档
    228 | 229 | 230 | 231 |
    232 |
    233 | 234 |
    235 |
    236 |

    237 |
    at line 79
    238 | string 239 | sendWithParam(string $nationCode, array $phoneNumbers, int $templId, array $params, string $sign = "", string $extend = "", string $ext = "") 240 | 241 |

    242 |
    243 | 244 | 245 | 246 |
    247 |

    指定模板群发

    248 |
    249 |

    Parameters

    250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 |
    string$nationCode国家码,如 86 为中国
    array$phoneNumbers不带国家码的手机号列表
    int$templId模板id
    array$params模板参数列表,如模板 {1}...{2}...{3},那么需要带三个参数
    string$sign签名,如果填空串,系统会使用默认签名
    string$extend扩展码,可填空串
    string$ext服务端原样返回的参数,可填空串
    288 | 289 | 290 |

    Return Value

    291 | 292 | 293 | 294 | 295 | 296 | 297 |
    string应答json字符串,详细内容参见腾讯云协议文档
    298 | 299 | 300 | 301 |
    302 |
    303 | 304 |
    305 |
    306 | 307 | 308 |
    309 | 312 | 313 |
    314 |
    315 | 316 | 317 | 318 | -------------------------------------------------------------------------------- /docs/Qcloud/Sms/SmsSingleSender.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Qcloud\Sms\SmsSingleSender | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 71 |
    72 |
    73 | 74 | 80 | 81 |

    class 82 | SmsSingleSender 83 |

    84 | 85 | 86 | 87 | 88 |
    89 |

    单发短信类

    90 | 91 | 92 | 93 | 94 |

    Methods

    95 | 96 |
    97 |
    98 |
    99 | 100 |
    101 |
    102 | __construct(string $appid, string $appkey) 103 | 104 |

    构造函数

    105 |
    106 |
    107 |
    108 |
    109 | string 110 |
    111 |
    112 | send(int $type, string $nationCode, string $phoneNumber, string $msg, string $extend = "", string $ext = "") 113 | 114 |

    普通单发

    115 |
    116 |
    117 |
    118 |
    119 | string 120 |
    121 |
    122 | sendWithParam(string $nationCode, string $phoneNumber, int $templId = 0, array $params, string $sign = "", string $extend = "", string $ext = "") 123 | 124 |

    指定模板单发

    125 |
    126 |
    127 |
    128 | 129 | 130 |

    Details

    131 | 132 |
    133 |
    134 |

    135 |
    at line 24
    136 | 137 | __construct(string $appid, string $appkey) 138 | 139 |

    140 |
    141 | 142 | 143 | 144 |
    145 |

    构造函数

    146 |
    147 |

    Parameters

    148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 |
    string$appidsdkappid
    string$appkeysdkappid对应的appkey
    161 | 162 | 163 | 164 | 165 |
    166 |
    167 | 168 |
    169 |
    170 |

    171 |
    at line 45
    172 | string 173 | send(int $type, string $nationCode, string $phoneNumber, string $msg, string $extend = "", string $ext = "") 174 | 175 |

    176 |
    177 | 178 | 179 | 180 |
    181 |

    普通单发

    普通单发需明确指定内容,如果有多个签名,请在内容中以【】的方式添加到信息内容中,否则系统将使用默认签名。

    182 |
    183 |

    Parameters

    184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 |
    int$type短信类型,0 为普通短信,1 营销短信
    string$nationCode国家码,如 86 为中国
    string$phoneNumber不带国家码的手机号
    string$msg信息内容,必须与申请的模板格式一致,否则将返回错误
    string$extend扩展码,可填空串
    string$ext服务端原样返回的参数,可填空串
    217 | 218 | 219 |

    Return Value

    220 | 221 | 222 | 223 | 224 | 225 | 226 |
    string应答json字符串,详细内容参见腾讯云协议文档
    227 | 228 | 229 | 230 |
    231 |
    232 | 233 |
    234 |
    235 |

    236 |
    at line 82
    237 | string 238 | sendWithParam(string $nationCode, string $phoneNumber, int $templId = 0, array $params, string $sign = "", string $extend = "", string $ext = "") 239 | 240 |

    241 |
    242 | 243 | 244 | 245 |
    246 |

    指定模板单发

    247 |
    248 |

    Parameters

    249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 |
    string$nationCode国家码,如 86 为中国
    string$phoneNumber不带国家码的手机号
    int$templId模板 id
    array$params模板参数列表,如模板 {1}...{2}...{3},那么需要带三个参数
    string$sign签名,如果填空串,系统会使用默认签名
    string$extend扩展码,可填空串
    string$ext服务端原样返回的参数,可填空串
    287 | 288 | 289 |

    Return Value

    290 | 291 | 292 | 293 | 294 | 295 | 296 |
    string应答json字符串,详细内容参见腾讯云协议文档
    297 | 298 | 299 | 300 |
    301 |
    302 | 303 |
    304 |
    305 | 306 | 307 |
    308 | 311 | 312 |
    313 |
    314 | 315 | 316 | 317 | -------------------------------------------------------------------------------- /docs/doc-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Index | API 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 |
    26 | 29 |
    30 | 31 | 35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 | 65 | 66 |
    67 | 68 | 71 | 72 |
      73 |
    • A
    • 74 |
    • B
    • 75 |
    • C
    • 76 |
    • D
    • 77 |
    • E
    • 78 |
    • F
    • 79 |
    • G
    • 80 |
    • H
    • 81 |
    • I
    • 82 |
    • J
    • 83 |
    • K
    • 84 |
    • L
    • 85 |
    • M
    • 86 |
    • N
    • 87 |
    • O
    • 88 |
    • P
    • 89 |
    • Q
    • 90 |
    • R
    • 91 |
    • S
    • 92 |
    • T
    • 93 |
    • U
    • 94 |
    • V
    • 95 |
    • W
    • 96 |
    • X
    • 97 |
    • Y
    • 98 |
    • Z
    • 99 |
    100 | 101 |

    C

    102 |
    SmsSenderUtil::calculateSig() — Method in class SmsSenderUtil
    103 |
    生成签名
    SmsSenderUtil::calculateSigForTemplAndPhoneNumbers() — Method in class SmsSenderUtil
    104 |
    生成签名
    SmsSenderUtil::calculateSigForTempl() — Method in class SmsSenderUtil
    105 |
    生成签名
    SmsSenderUtil::calculateSigForPuller() — Method in class SmsSenderUtil
    106 |
    生成签名
    SmsSenderUtil::calculateAuth() — Method in class SmsSenderUtil
    107 |
    生成上传文件授权

    F

    108 |
    FileVoiceSenderClass in namespace Qcloud\Sms
    109 |
    按语音文件fid发送语音通知类
    SmsSenderUtil::fetch() — Method in class SmsSenderUtil
    110 |
    发送请求

    G

    111 |
    SmsSenderUtil::getRandom() — Method in class SmsSenderUtil
    112 |
    生成随机数

    P

    113 |
    SmsMobileStatusPuller::pullCallback() — Method in class SmsMobileStatusPuller
    114 |
    拉取回执结果
    SmsMobileStatusPuller::pullReply() — Method in class SmsMobileStatusPuller
    115 |
    拉取回复信息
    SmsSenderUtil::phoneNumbersToArray() — Method in class SmsSenderUtil
    116 |
    SmsStatusPuller::pullCallback() — Method in class SmsStatusPuller
    117 |
    拉取回执结果
    SmsStatusPuller::pullReply() — Method in class SmsStatusPuller
    118 |
    拉取回复信息

    S

    119 |
    FileVoiceSender::send() — Method in class FileVoiceSender
    120 |
    按语音文件fid发送语音通知
    SmsMobileStatusPullerClass in namespace Qcloud\Sms
    121 |
    拉取单个手机短信状态类
    SmsMultiSenderClass in namespace Qcloud\Sms
    122 |
    群发短信类
    SmsMultiSender::send() — Method in class SmsMultiSender
    123 |
    普通群发
    SmsMultiSender::sendWithParam() — Method in class SmsMultiSender
    124 |
    指定模板群发
    SmsSenderUtilClass in namespace Qcloud\Sms
    125 |
    发送Util类
    SmsSenderUtil::sha1sum() — Method in class SmsSenderUtil
    126 |
    生成sha1sum
    SmsSenderUtil::sendCurlPost() — Method in class SmsSenderUtil
    127 |
    发送请求
    SmsSingleSenderClass in namespace Qcloud\Sms
    128 |
    单发短信类
    SmsSingleSender::send() — Method in class SmsSingleSender
    129 |
    普通单发
    SmsSingleSender::sendWithParam() — Method in class SmsSingleSender
    130 |
    指定模板单发
    SmsStatusPullerClass in namespace Qcloud\Sms
    131 |
    拉取短信状态类
    SmsVoicePromptSenderClass in namespace Qcloud\Sms
    132 |
    发送语音通知类
    SmsVoicePromptSender::send() — Method in class SmsVoicePromptSender
    133 |
    发送语音通知
    SmsVoiceVerifyCodeSenderClass in namespace Qcloud\Sms
    134 |
    发送语音验证码类
    SmsVoiceVerifyCodeSender::send() — Method in class SmsVoiceVerifyCodeSender
    135 |
    发送语音验证码
    TtsVoiceSender::send() — Method in class TtsVoiceSender
    136 |
    指定模板发送语音短信

    T

    137 |
    TtsVoiceSenderClass in namespace Qcloud\Sms
    138 |
    指定模板发送语音通知类

    U

    139 |
    VoiceFileUploader::upload() — Method in class VoiceFileUploader
    140 |
    上传语音文件

    V

    141 |
    VoiceFileUploaderClass in namespace Qcloud\Sms
    142 |
    上传语音文件类

    _

    143 |
    FileVoiceSender::__construct() — Method in class FileVoiceSender
    144 |
    构造函数
    SmsMobileStatusPuller::__construct() — Method in class SmsMobileStatusPuller
    145 |
    构造函数
    SmsMultiSender::__construct() — Method in class SmsMultiSender
    146 |
    构造函数
    SmsSingleSender::__construct() — Method in class SmsSingleSender
    147 |
    构造函数
    SmsStatusPuller::__construct() — Method in class SmsStatusPuller
    148 |
    构造函数
    SmsVoicePromptSender::__construct() — Method in class SmsVoicePromptSender
    149 |
    构造函数
    SmsVoiceVerifyCodeSender::__construct() — Method in class SmsVoiceVerifyCodeSender
    150 |
    构造函数
    TtsVoiceSender::__construct() — Method in class TtsVoiceSender
    151 |
    构造函数
    VoiceFileUploader::__construct() — Method in class VoiceFileUploader
    152 |
    构造函数
    153 | 156 | 157 |
    158 |
    159 | 160 | 161 | 162 | --------------------------------------------------------------------------------