1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env bash sendSms(){ password=$( eval echo -n ${password}|md5sum| cut -d ' ' -f1) content= "${content// /%20}" url=${smsapi} "sms?u=" ${user} "&p=" ${password} "&m=" ${phone} "&c=" ${content} result=`curl -s ${url}` statusStr } statusStr(){ case ${result} in 0) echo "短信发送成功" ;; -1) echo "参数不全" ;; -2) echo "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!" ;; 30) echo "密码错误" ;; 40) echo "账号不存在" ;; 41) echo "余额不足" ;; 42) echo "账户已过期" ;; 43) echo "IP地址限制" ;; 50) echo "内容含有敏感词" ;; esac } smsapi= "http://api.smsbao.com/" #短信平台账号 user= "***" #短信平台密码 password= "****" #要发送的短信内容 content= "短信内容" #要发送短信的手机号码 phone= "****" sendSms |