当前位置:网站首页>【Golang】golang实现post请求发送form类型数据函数
【Golang】golang实现post请求发送form类型数据函数
2022-07-24 11:05:00 【陶士涵】
golang实现post请求发送form类型数据函数
//发送http post请求数据为form
func PostForm(url string, data url.Values) (string, error) {
resp, err := http.PostForm(url, data)
if err != nil {
return "", err
}
defer resp.Body.Close()
content, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(content), nil
}使用方式如下:
data := url.Values{}
data.Set("phone", phone)
data.Set("password", password)
data.Set("host", host)
res, err := PostForm("/xxxxxxx", data)边栏推荐
- The difference between Lora wireless technology and lorawan gateway module
- Simply use MySQL index
- 变频器的四大组成部分和工作原理
- MySQL query field matches the record of a rule
- High speed ADC test experience
- Data visualization - White Snake 2: black snake robbery (1)
- 零基础学习CANoe Panel(8)—— 数据/文本编辑控件(Hex/Text Editor )
- Development and course of Bluetooth Technology
- read_csv 报错:‘gbk‘ codec can‘t decode byte 0xb4 in position 274: illegal multibyte sequence
- 零基础学习CANoe Panel(7)—— 文件选择(PathDiaglog)
猜你喜欢

Publish local images to Alibaba cloud

MySQL engine

Over the weekend, I had a dinner with the technology gurus and talked about the "golden nine and silver ten" peak of the software testing industry [the trend of involution has been formed]

在idea中System.getProperty(“user.dir“)识别到模块(module)路径的方法:Working directory的设置

浅析拉格朗日乘数法及其对偶问题
![[class, abstraction and inheritance]](/img/eb/4c8d0c86b1320015b2ccb0289f4f00.png)
[class, abstraction and inheritance]

JMeter接口测试步骤-安装教程-脚本录制-并发测试

Read the triode easily. It turns out that it works like this

变频器的工作原理和功能应用
![[FPGA]: IP core ibert](/img/f9/ef4c8d44be2e27b6d85010ca8cdefa.png)
[FPGA]: IP core ibert
随机推荐
Zero basic learning canoe panel (8) -- hex/text editor
Detailed explanation and example demonstration of Modbus RTU communication protocol
Publish local images to Alibaba cloud
"Low power Bluetooth module" master-slave integrated Bluetooth sniffer - help smart door lock
Simply understand MODBUS function code and partition
只会“点点点”,凭什么让开发看得起你?
Signal processing: < three > DFT and FFT
性能测试总结(一)---基础理论篇
Redismission inventory deduction demo
How to convert word to markdown text
【白帽子讲Web安全】第二章 浏览器安全
STM32+ESP8266+MQTT协议连接阿里云物联网平台
Cub school learning - Kernel Development
Installing Oracle Xe with Linux
Five application scenarios of Bluetooth module
[FPGA]: IP core -- xadc
MySQL paging
Siemens 200smart self created library and description
[white hat talks about web security] Chapter 1 my security world view
read_csv 报错:‘gbk‘ codec can‘t decode byte 0xb4 in position 274: illegal multibyte sequence