add postform request

This commit is contained in:
Juan Roig 2023-10-31 02:30:30 -04:00
parent c411ee3447
commit 410a8c7f18

View File

@ -50,7 +50,7 @@ func get_course_ids(canvas_courses []CanvasCourse) []uint64 {
return courses return courses
} }
// parseForm extracts form fields and values from the given HTML form string. // parse_form extracts form fields and values from the given HTML form string.
func parse_form(form_html string) url.Values { func parse_form(form_html string) url.Values {
form_values := make(url.Values) form_values := make(url.Values)
inputs := strings.Split(form_html, "<input") inputs := strings.Split(form_html, "<input")
@ -152,6 +152,13 @@ func main() {
for key, values := range form_values { for key, values := range form_values {
fmt.Printf("%s: %s\n", key, values) fmt.Printf("%s: %s\n", key, values)
} }
//req, err := http.PostForm("https://floridapoly.aplusattendance.com/canvas", form_values)
req, err := client.PostForm("https://floridapoly.aplusattendance.com/canvas", form_values)
body, err = io.ReadAll(req.Body)
fmt.Println(string(body))
fmt.Println(req)
} }
/* /*