这篇文章主要为大家分享GO短信接口代码,GO短信发送、GO批量发送、GO短信验证码发送,感兴趣的小伙伴们可以参考一下。
支持语言:GO
功能:GO短信接口、GO发送短信
用途:短信验证码、会员营销短信、各类通知短信
支持语言:GO
功能:GO短信接口、GO发送短信
用途:短信验证码、会员营销短信、各类通知短信
注意事项:该代码仅供接入秒赛短信接口参考使用,客户可根据实际需要自行编写;
package
main
import
(
"net/http"
"io/ioutil"
"net/url"
"fmt"
)
func main(){
//账号
account :=
"***************"
//密码
pswd :=
"***************"
// 修改为您要发送的手机号码,多个号码用逗号隔开
mobile :=
"***************"
//短信内容
contentyzm :=
"【秒赛科技】您的验证码是:1234"
// 发送url,请咨询客服
url_send :=
"xxxxxxxxxxxxxxxxxxx"
;
data_send := url.Values{
"account"
: {account},
"pswd"
: {pswd},
"mobile"
: {mobile},
"msg"
:{msg},
"needstatus"
:
"true"
}
httpsPostForm(url_send,data_send)
}
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))
}