Linux使用curl命令发送请求

阅读 77

2023-03-31


curl进行命令post formdata json file

post formdata多个参数
post json带头部
post文件
POST application/x-www-form-urlencoded

post formdata多个参数

多个参数可以使用-F进行串接

curl -X POST -F 'accountId=xxxxxx' -F 'meetingId=xxxx' -F 'type=1' http://192.168.10.126:8088/api/web/xxxx/checkState

post json带头部

curl -X POST -H 'Content-Type: application/json' -d '{"username":"davidwalsh","password":"something"}' http://xxxx/login

post文件

curl -X POST -F 'image=@/path/to/pictures/picture.jpg' http://xxxx/upload

POST application/x-www-form-urlencoded

curl -d "param1=value1¶m2=value2" -X POST http://localhost:3000/data

or

curl -d "param1=value1¶m2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:3000/data


精彩评论(0)

0 0 举报