shell脚本传参调用http接口

1, shell 脚本传参调用http接口

[root@test aa]# cat a.sh
mobile=$1   #180xxxx1234
content=$2  #'测试告警123 , 业务系统: xxx'

echo "===>"$(date +'%F %T') $mobile, $content>> /xx/send.log
curl -s -H 'Content-Type: application/json'  \
-H 'appkey: xxxxxx' \
-XPOST http://192.xx.xx.xx:80/sms/send \
  -d "{
	  'mobile':'$mobile', 
	  'content':'$content', 
	  'sendtime':'',
	  'needreport':0
}"  &>>  /xx/send.log

2, 测试验证

[root@test aa]# sh a.sh  180xxxx1111 'test123 ,业务系统:aaa'

[root@test aa]# tail send.log
===>2024-07-15 16:14:58 180xxxx1111, test123 ,业务系统:aaa
{"code":"0","msg":"success"}

相关推荐

  1. shell脚本调用http接口

    2024-07-15 19:48:01       18 阅读
  2. shell调用http接口

    2024-07-15 19:48:01       43 阅读
  3. SpringBoot和Vue接口调用方式

    2024-07-15 19:48:01       48 阅读
  4. Https接口调用问题

    2024-07-15 19:48:01       48 阅读
  5. python调用http接口

    2024-07-15 19:48:01       55 阅读
  6. websocket调用http接口

    2024-07-15 19:48:01       28 阅读
  7. html调用http接口

    2024-07-15 19:48:01       31 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-15 19:48:01       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-15 19:48:01       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-15 19:48:01       58 阅读
  4. Python语言-面向对象

    2024-07-15 19:48:01       69 阅读

热门阅读

  1. JsonCPP源码分析——分配器和配置器

    2024-07-15 19:48:01       16 阅读
  2. Web开发:<div>标签作用

    2024-07-15 19:48:01       21 阅读
  3. 查找子串方法总结

    2024-07-15 19:48:01       24 阅读
  4. 两个事务update同一条数据会发生什么?

    2024-07-15 19:48:01       22 阅读