How Answer A Google Forms Through Code?

Hello mates, I have created a Google Forms link (https://forms.gle/vptCsVvXJ6an7gaT7) and I am trying to send the answers from inside the code. Anyone could help me to start, or with some sample code, how answer a google forms from inside the code?

I ma trying the following solutions:

package main

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

func HTTP(url string) (string, error) {
	resp, err := http.Get(url)
	if err != nil {
		return "", fmt.Errorf("GET error: %v", err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		return "", fmt.Errorf("Status error: %v", resp.StatusCode)
	}

	data, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return "", fmt.Errorf("Read body: %v", err)
	}

	return string(data), nil
}
func main() {
	fmt.Println("\nEnter your name")
	var name string
	fmt.Scan(&name)

	fmt.Println("\nEnter email:")
	var emailreponse string
	fmt.Scan(&emailreponse)

	HTTP_0 := "https://docs.google.com/forms/d/e/1FAIpQLSfd8LRjHq4lRdWDb64hoBzTLGaNPn4TLeE5G-2Fp3HhJVcmmg/"
	HTTP_1 := "formResponse?&submit=Submit?"
	HTTP_2 := "usp=pp_url"
	Entry_0 := "&entry.194375880=" + name
	Entry_1 := "&entry.2012222327=" + emailreponse


	FormResponse, _ := HTTP(HTTP_0 + HTTP_1 + HTTP_2 + Entry_0 + Entry_1)

	fmt.Println(FormResponse)

}

I change the forms to this one https://forms.gle/pevmW2QHyg9QdeDc9 where the email is not automatic collected.

But I do not know how send this url, I think use Get is not the correct approach right?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.