当前位置:网站首页>【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)边栏推荐
- 【白帽子讲Web安全】第二章 浏览器安全
- 1184. 公交站间的距离 : 简单模拟题
- Use Modelsim to independently simulate Altera and Xilinx IP cores
- [micro service] eureka+ribbon realizes registration center and load balancing
- Zero basic learning canoe panel (7) -- input/output box
- Cub school learning - Kernel Development
- [FPGA]: IP core DDS
- Openresty Lua resty logger socket log transfer
- Zero basic learning canoe panel (10) -- checkbox
- 零基础学习CANoe Panel(6)—— 开关/显示控件(Switch/Indicator)
猜你喜欢

轻松读懂三极管,原来它是这样工作的

Disk storage chain B-tree and b+ tree

Simply understand MODBUS function code and partition
![[FPGA]: use of MicroBlaze](/img/f4/5114bf4bde10adaa22c7441350575c.png)
[FPGA]: use of MicroBlaze

Zero basis learning canoe panel (5) -- change the value of the variable, and the control image also changes. What's going on?

西门子200smart自创库与说明

Altium one key automatic BOM

Selenium automated test (this one is enough) - self study

性能测试总结(一)---基础理论篇

Detailed explanation of Flink operation architecture
随机推荐
High speed ADC test experience
In idea, system.getproperty ("user.dir") identifies the path of the module: the setting of the working directory
JMeter interface test steps - Installation Tutorial - script recording - concurrent test
在线客服聊天系统源码_美观强大golang内核开发_二进制运行傻瓜式安装_附搭建教程
Take care of me when I meet you for the first time
Web salted fish self rescue strategy -- typescript classes are not as difficult as you think
小熊派学习——内核开发
read_ CSV error: 'GBK' codec can't decode byte 0xb4 in position 274: illegal multibyte sequence
零基础学习CANoe Panel(7)—— 文件选择(PathDiaglog)
Five application scenarios of Bluetooth module
Neo4j installation tutorial
Collation of important MySQL configuration parameters
This should be postman, the most complete interface testing tool in the whole network
变频器的四大组成部分和工作原理
新式拥塞控制漫谈
[FPGA]: IP core - multiplier
Druid encryption command
About [software testing - interview skills and precautions for automated testing] - talk freely
关于【软件测试-自动化测试之面试技巧和注意事项】——侃侃而谈
Kubernetes Foundation