package main import ( "fmt" "io/@R_301_437@til" "net/http" "net/url" "strings" ) func httpGet() { resp,err := http.Get("http://www.01happy.com/demo/accept.PHP?id=1") if err != nil { // handle error } defer resp.Body.Close() body,err := @R_301_437@til.ReadAll(resp.Body) if err != nil { // handle error } fmt.Println(string(body)) } func httpPost() { resp,err := http.Post("http://www.01happy.com/demo/accept.PHP","application/x-www-form-urlencoded",strings.NewReader("name=cjb")) if err != nil { fmt.Println(err) } defer resp.Body.Close() body,err := @R_301_437@til.ReadAll(resp.Body) if err != nil { // handle error } fmt.Println(string(body)) } func httpPostForm() { resp,err := http.PostForm("http://www.01happy.com/demo/accept.PHP",url.Values{"key": {"Value"},"id": {"123"}}) if err != nil { // handle error } defer resp.Body.Close() body,err := @R_301_437@til.ReadAll(resp.Body) if err != nil { // handle error } fmt.Println(string(body)) } func httpDo() { client := &http.Client{} req,err := http.NewRequest("POST","http://www.01happy.com/demo/accept.PHP",strings.NewReader("name=cjb")) if err != nil { // handle error } req.Header.Set("Content-Type","application/x-www-form-urlencoded") req.Header.Set("Cookie","name=anny") resp,err := client.Do(req) defer resp.Body.Close() body,err := @R_301_437@til.ReadAll(resp.Body) if err != nil { // handle error } fmt.Println(string(body)) }