Go Sample Code Send SMS

 In sample code

Go Sample Code Send SMS

package main

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

func main() {

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


urlToPost := "http://priority.muzztech.in/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))

}
Recent Posts

Leave a Comment

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

0