go DEMO


功能說明:該接口要求提前在云片后臺(tái)添加模板,提交短信時(shí),系統(tǒng)會(huì)自動(dòng)匹配審核通過的模板,匹配成功任意一個(gè)模板即可發(fā)送。系統(tǒng)已提供的默認(rèn)模板添加簽名后可以直接使用。


package main
import (
    "net/http"
    "io/ioutil"
    "net/url"
    "fmt"
 )
// bingone
func main(){

    // 修改為您的apikey(http://www.ssjdyy2.com)登錄官網(wǎng)后獲取
    apikey      := "xxxxxxxxxxxxxxxxxx"
     // 修改為您要發(fā)送的手機(jī)號(hào)碼,多個(gè)號(hào)碼用逗號(hào)隔開
    mobile      := "xxxxxxxxxxxxxxxxxx"
    // 發(fā)送內(nèi)容
    text        := "【云片網(wǎng)】您的驗(yàn)證碼是1234,5分鐘內(nèi)有效。"
    // 發(fā)送模板編號(hào)
    tpl_id      := 365741
    // 語(yǔ)音驗(yàn)證碼
    code        := "1234"
    min         := "5"
    // 發(fā)送模板內(nèi),實(shí)際傳入的變量名稱和個(gè)數(shù)以實(shí)際調(diào)用的模板中的變量為準(zhǔn)
    tpl_value   := url.Values{"#code#":{code},"#min#":{min}}.Encode()

    // 獲取user信息url
    url_get_user    := "https://sms.yunpian.com/v2/user/get.json";
    // 智能模板發(fā)送短信url
    url_send_sms    := "https://sms.yunpian.com/v2/sms/single_send.json";
    // 指定模板發(fā)送短信url
    url_tpl_sms     := "https://sms.yunpian.com/v2/sms/tpl_single_send.json";
    // 發(fā)送語(yǔ)音短信url
    url_send_voice  := "https://voice.yunpian.com/v2/voice/send.json";

    data_get_user   := url.Values{"apikey": {apikey}}
    data_send_sms   := url.Values{"apikey": {apikey}, "mobile": {mobile},"text":{text}}
    data_tpl_sms := url.Values { "apikey": {apikey},"mobile": {mobile},
        "tpl_id": {fmt.Sprintf("%d", tpl_id)},"tpl_value": {tpl_value}}
    data_send_voice := url.Values{"apikey": {apikey}, "mobile": {mobile},"code":{code}}


    httpsPostForm(url_get_user,data_get_user)
    httpsPostForm(url_send_sms,data_send_sms)
    httpsPostForm(url_tpl_sms,data_tpl_sms)
    httpsPostForm(url_send_voice,data_send_voice)
}

func httpsPostForm(url string,data url.Values) {
    resp, err := http.PostForm(url,data)

    if err != nil {
        // handle error
    }

    defer resp.Body.Close()
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        // handle error
    }

    fmt.Println(string(body))

}
特黄人与动人物视频A级毛片,久久婷婷五月色综合蜜芽,亚洲AV永久无码区成人网站,精品无码成人网站久久久久久无码 ,日本动漫爆乳H动漫啪啪免费,成年女人毛片免费视频喷潮,一本之道高清在线观看免费,一级A片无遮挡,18禁美女挤奶水视频免费,欧美牲交A欧美牲交AⅤ电影