package main import ( "fmt" "net/http" "net/url" "strings" ) func main() { httpDo() } func httpDo() { proxy := func(_ *http.Request) (*url.URL, error) { return url.Parse("http://120.78.78.141:8888") } transport := &http.Transport{Proxy: proxy} client := &http.Client{Transport: transport} var r http.Request r.ParseForm() r.Form.Add("uuid", "12311") bodystr := strings.TrimSpace(r.Form.Encode()) req, err := http.NewRequest("POST", "http://www.coffiasd.cn/app/test_proxy", strings.NewReader(bodystr)) if err != nil { // handle error } req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("User-Agent", "client-sn22") resp, err := client.Do(req) defer resp.Body.Close() fmt.Println("Http reurened stats %v", resp.Status) }