diff --git a/sms/freesms b/sms/freesms index a4e7589..fe511f6 100755 --- a/sms/freesms +++ b/sms/freesms @@ -71,7 +71,21 @@ if [ -z "${MESSAGE}" ] ; then exit 1 fi -envoi=$(curl -i --insecure "https://smsapi.free-mobile.fr/sendmsg?user=${NOM}&pass=${PASS}&msg=${MESSAGE}" 2>&1) +if ! which which > /dev/null 2>&1 ; then + echo "which is not installed" + exit 1 +elif which curl > /dev/null 2>&1 ; then + echo using curl + BIN="curl -i --insecure" +elif which wget > /dev/null 2<&1 ; then + echo using wget + BIN="wget --save-headers -qO -" +elif true ; then + echo "None of curl or wget installed" >&2 + exit 1 +fi + +envoi=$(${BIN} "https://smsapi.free-mobile.fr/sendmsg?user=${NOM}&pass=${PASS}&msg=${MESSAGE}" 2>&1) retour_HTTP=$(echo "${envoi}" | awk '/HTTP/ {print $2}') case $retour_HTTP in 200)