Linux Bash Curl Post的例子

2020-12-24 1358点热度 0人点赞 0条评论

运维的Bash脚本,有时候需要把bash运行结果post到一个网址,来看下怎么做:

例子:POST JSON
msg="So _advanced_ Much *innovations* ?"
#post JSON

curl -X POST \
       -H 'Content-Type: application/json' \
       -d '{"chat_id": "xxxx", "parse_mode": "Markdown", "text": "'"$msg"'"}' \
       https://www.example.com/api
例子:POST FORM DATA
#post form
curl POST --data 'param1=xxx' \
    --data 'token=yyy' \
       	https://www.example.com/api

 

admin

这个人很懒,什么都没留下

文章评论

您需要 登录 之后才可以评论