From anonymous, 1 Year ago, written in Bash.
This paste is a reply to Re: Untitled from anonymous
- go back
Embed
Viewing differences between Re: Untitled and Re: Re: Untitled
#!/bin/bash

account="..."
token="..."
from='...'
to="$1"
maxlength=121
shift

data="$*"
(( ${#data} > $maxlength )) && data="${data:0:((maxlength-3))}..."

curl -X POST "https://api.twilio.com/2010-04-01/Accounts/$account/SMS/Messages.json" \
     --data-urlencode "From=$from" \
     --data-urlencode "To=$to" \
     --data-urlencode "Body=$data" \
     -u "$account:$token" &> /dev/null