运维的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
文章评论