package main import ( "fmt" "io/ioutil" "net/http" "net/url" "strings" ) // Note: This example code ignores errors func main() { data := url.Values{} data.Set("content", "Hello!") data.Set("syntax", "go") client := &http.Client{} r, _ := http.NewRequest("POST", "https://dpaste.com/api/", strings.NewReader(data.Encode())) r.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, _ := client.Do(r) body, _ := ioutil.ReadAll(res.Body) fmt.Println(string(body)) }