Advertisement
cindy_wijaya

Kirim SMS Modem Huawei e3372 Hilink

May 5th, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.56 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. NUMBER=$1
  4. MESSAGE=$2
  5.  
  6. LENGTH=${#MESSAGE}
  7. TIME=$(date +"%Y-%m-%d %T")
  8. TOKEN=$(curl -v 'http://192.168.8.1/api/webserver/token' | sed -n 's:.*<token>\(.*\)</token>.*:\1:p')
  9.  
  10. SMS="<?xml version="1.0" encoding="UTF-8"?><request><Index>-1</Index><Phones><Phone>$NUMBER</Phone></Phones><Sca></Sca><Content>$MESSAGE</Content><Length>$LENGTH</Length><Reserved>1</Reserved><Date>$TIME</Date></request>"
  11.  
  12. curl 'http://192.168.8.1/api/sms/send-sms' -H "__RequestVerificationToken: $TOKEN" --data "$SMS" --compressed
  13.  
  14. #Usage: ./send-sms.sh +55555555 'hey there'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement