summaryrefslogtreecommitdiff
path: root/e3372-sendsms.sh
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-03-22 23:25:34 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-03-22 23:25:39 +0300
commit91b6b387e19ad2b2f686e8a27bfc0a027e9eb4d9 (patch)
tree2be275e79d58e8f8f69166086c11ca3cbe1d9ed3 /e3372-sendsms.sh
parentc8fb7cd3987d3128bcee5962a5af4cd282add24e (diff)
eliminate a lot of copypasta by using functions
Diffstat (limited to 'e3372-sendsms.sh')
-rwxr-xr-xe3372-sendsms.sh11
1 files changed, 4 insertions, 7 deletions
diff --git a/e3372-sendsms.sh b/e3372-sendsms.sh
index 9740775..6b7e3fa 100755
--- a/e3372-sendsms.sh
+++ b/e3372-sendsms.sh
@@ -3,12 +3,9 @@
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
. "$DIR/include.sh"
-get_token
+SMS_DATA="<?xml version='1.0' encoding='UTF-8'?><request><Index>-1</Index><Phones><Phone>363</Phone></Phones><Sca></Sca><Content>USAGE</Content><Length>5</Length><Reserved>1</Reserved><Date>-1</Date></request>"
-curl -s -X POST "http://$MODEM_IP/api/sms/send-sms" \
- -H "Cookie: $COOKIE" \
- -H "__RequestVerificationToken: $TOKEN" \
- -H "Content-Type: text/xml" \
- -d "<?xml version='1.0' encoding='UTF-8'?><request><Index>-1</Index><Phones><Phone>363</Phone></Phones><Sca></Sca><Content>USAGE</Content><Length>5</Length><Reserved>1</Reserved><Date>-1</Date></request>" >modem_status.xml
+get_token
+post_xml "sms/send-sms" "$SMS_DATA" > $STATUS_FILE
-cat modem_status.xml \ No newline at end of file
+cat $STATUS_FILE \ No newline at end of file