package main import ( "fmt" "log" "net/http" "strings" ) func BindUserWithWX(url, contentType, body string) (*http.Response, error) { // body := `{"userinfo":"tmr.shengmu23.bbc","openid":"123"}` // url :="http://kpttest.kptyun.com/userwxopenid/binding" // contentType:="application/json" resp, err := http.Post(url, contentType, strings.NewReader(body)) if err != nil { log.Default().Printf("%+v\n", err) return nil, err } defer resp.Body.Close() fmt.Printf("%+v\n", resp) return resp, nil }