Python
- 1 ответ
- 0 вопросов
1
Вклад в тег
func Init() string {
res := make(map[string]string)
res["param1"] = "1"
res["param2"] = "2"
data, err := json.Marshal(res)
checkErr(err)
return string(data)
}
func NewBlank() {
address := "http://pbrf.ru/pdf.F7"
fmt.Println("URL:>", address)
payload := url.Values{"access_token": []string{"3e17b2be0282a44505"}, "data": []string{Init()}}
req, err := http.NewRequest("POST", address, bytes.NewBuffer([]byte(payload.Encode())))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
client := &http.Client{}
resp, err := client.Do(req)
checkErr(err)
defer resp.Body.Close()
fmt.Println("response Status:", resp.Status)
fmt.Println("response Headers:", resp.Header)
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println("response Body:", string(body))