Ajout d'un test pour savoir l'on doit uiliser curl ou wget
Ajout d'un test pour savoir si which est installé
This commit is contained in:
parent
6f8af2eaa1
commit
a54759a7fc
16
sms/freesms
16
sms/freesms
@ -71,7 +71,21 @@ if [ -z "${MESSAGE}" ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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}')
|
retour_HTTP=$(echo "${envoi}" | awk '/HTTP/ {print $2}')
|
||||||
case $retour_HTTP in
|
case $retour_HTTP in
|
||||||
200)
|
200)
|
||||||
|
Loading…
Reference in New Issue
Block a user