func GetSiteInfo(host string, token string) (InfoMoodle, error) {
	var result InfoMoodle

	resp, err := http.PostForm(host+"webservice/rest/server.php?moodlewsrestformat=json", url.Values{
		"wstoken":    {token},
		"wsfunction": {"core_webservice_get_site_info"},
	})
	if err != nil {
		log.Println(err)
		return result, err
	}

	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Println(err)
		return result, err
	}

	// Get the content
	err = json.Unmarshal([]byte(body), &result)

	return result, err
}
// GetSiteInfo requests the information about the user and the moodle
// Request: <host>/webservice/rest/server.php?moodlewsrestformat=json
// Body: wstoken: token, wsfunction: core_webservice_get_site_info
// Returns a InfoMoodle object if the request was successful (even if an error
// was received) or an error if it wasn't able to connect to the server
GetSiteInfo requests the information about the user and the moodle
Request: /webservice/rest/server.php?moodlewsrestformat=json
Body: wstoken: token, wsfunction: core_webservice_get_site_info
Returns a InfoMoodle object if the request was successful (even if an error
was received) or an error if it wasn't able to connect to the server
// GetSiteInfo requests the information about the user and the moodle // Request : <host > / webservice / rest / server . php?moodlewsrestformat = json // Body : wstoken : token wsfunction : core_webservice_get_site_info // Returns a InfoMoodle object if the request was successful ( even if an error // was received ) or an error if it wasn ' t able to connect to the server
func GetSiteInfo(host string, token string) (InfoMoodle, error) {
	var result InfoMoodle
	resp, err := http.PostForm(host+"webservice/rest/server.php?moodlewsrestformat=json", url.Values{
		"wstoken":    {token},
		"wsfunction": {"core_webservice_get_site_info"},
	})
	if err != nil {
		log.Println(err)
		return result, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Println(err)
		return result, err
	}
	err = json.Unmarshal([]byte(body), &result)
	return result, err
}
func GetSiteInfo ( host string , token string ) ( InfoMoodle , error ) { var result InfoMoodle resp , err := http . PostForm ( host + " " , url . Values { " " : { token } , " " : { " " } , } ) if err != nil { log . Println ( err ) return result , err } defer resp . Body . Close ( ) body , err := ioutil . ReadAll ( resp . Body ) if err != nil { log . Println ( err ) return result , err } err = json . Unmarshal ( [ ] byte ( body ) , & result ) return result , err }
GetSiteInfo requests the information about the user and the moodle
Request: /webservice/rest/server.php?moodlewsrestformat=json
Body: wstoken: token, wsfunction: core_webservice_get_site_info
Returns a InfoMoodle object if the request was successful (even if an error
was received) or an error if it wasn't able to connect to the server
GetSiteInfo requests the information about the user and the moodle Request : / webservice / rest / server . php?moodlewsrestformat = json Body : wstoken : token wsfunction : core_webservice_get_site_info Returns a InfoMoodle object if the request was successful ( even if an error was received ) or an error if it wasn ' t able to connect to the server
// Get the content