Developer Tools
BasicText SMSCampaignSendOTPVirtual NumberResellerSample CodePhonebookError Code
HOME LOGIN SIGN UP
  • Send SMS in PHP
  • Send SMS in Python
  • Send SMS in JAVA
  • Send SMS in JAVA For XML API
  • Send SMS in C#
  • Send SMS in Google Appscript
  • Send SMS in Windows 8
  • Send SMS in Android
  • Send SMS in iOS
  • Send SMS in VB6
  • Send SMS in Oracle
  • Send SMS in Go Language
  • Api Postman Collection

Go Sample Code Send SMS

Code:

package main

import (
"fmt"
"strings"
"net/url"
"net/http"
"io/ioutil"
)

func main() {

message := "Hi hello ho & #42 *&23 w are you...."


urlToPost := "http://api.msg91.com/api/sendhttp.php"


form := url.Values{}
form.Add("authkey", "You AuthKey")
form.Add("mobiles", "9999999999")
form.Add("message", message)
form.Add("sender", "ALERTS")
form.Add("route", "4")

fmt.Println(form.Encode())

req, _ := http.NewRequest("POST", urlToPost, strings.NewReader(form.Encode()))

req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

}

© 2008-2025 | All Rights Reserved.