How to make HTTP Post request with Go Lang?


 

package main
import "net/http"
import "io/ioutil"
import "net/url"
func main(){
	data := url.Values{}
	data.Set("name", "value")
	data.Set("x", "3")
	data.Set("y", "4")
	link := "https://unconcealing-gage.000webhostapp.com/add.php"
	println("connecting ..")
	println(link)
	resp, err := http.PostForm(link, data)
	if nil != err {
		panic(err)
		return
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if nil != err {
		panic(err)
		return
	}
	println(string(body))
}
Download

Comments

Popular posts from this blog

Tecq Mate | Build APK with command line only | Build Android with cmd | No IDE | No Android Studio