package main import ( "crypto/md5" "encoding/hex" "fmt" "io/ioutil" "net/http" "net/url" "strconv" "strings" "time" ) func GetMd5String(s string) string { h := md5.New() h.Write([]byte(s)) return hex.EncodeToString(h.Sum(nil)) } func main() { v := url.Values{} _now := strconv.FormatInt(time.Now().Unix(), 10) //fmt.Printf(_now) _account := "帳號" _password := "接口密碼" _mobile := "158xxxxxxxx" _content := "您的訂單編碼:4557。如需幫助請聯(lián)系客服。" v.Set("account", _account) v.Set("password", GetMd5String(_account+_password+_mobile+_content+_now)) v.Set("mobile", _mobile) v.Set("content", _content) v.Set("time", _now) body := ioutil.NopCloser(strings.NewReader(v.Encode())) //把form數(shù)據(jù)編下碼 client := &http.Client{} req, _ := http.NewRequest("POST", "http://sms.106jiekou.com/utf8/sms.aspx", body) req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value") //fmt.Printf("%+v\n", req) //看下發(fā)送的結(jié)構(gòu) resp, err := client.Do(req) //發(fā)送 defer resp.Body.Close() //一定要關(guān)閉resp.Body data, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(data), err) }
友情鏈接:106短信平臺 | 發(fā)短信平臺 | 短信接口平臺 | 短信接口平臺哪個好 | 國際短信 | 短信通 | 短信接口應(yīng)用
關(guān)于我們 | 產(chǎn)品與服務(wù) | 解決方案 | 客戶案例 | 聯(lián)系我們 | 幫助指南 | 付款方式
Copyright © 2008-2018 短信通 . 速度網(wǎng)絡(luò)有限公司 短信接口應(yīng)用第一平臺 All rights reserved. 浙ICP備10040624號-2