Answer the question
In order to leave comments, you need to log in
How to pass a nested array in query parameters?
LoginForm: [username: ..... , password:.....] , how to pass such an array to a post request. I then need to take it to php as $_POST["LoginForm"]
Answer the question
In order to leave comments, you need to log in
client := http.DefaultClient
form := url.Values{
"LoginForm[username]": []string{"user"},
"LoginForm[password]": []string{"pass"},
}
response, err := client.Post("http://httpbin.org/post", "application/x-www-form-urlencoded", strings.NewReader(form.Encode()))
if err != nil {
panic(err)
}
defer response.Body.Close()
b, err := ioutil.ReadAll(response.Body)
if err != nil {
panic(err)
}
println(string(b))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question