#/bin/sh help() { echo "Syntaxe" echo "‾‾‾‾‾‾‾" echo "sh $0 [ adresse ] [ username ] [ password ]\n" } if [ -z "$1" ] then echo "Missing parameters : web adresses is needed\n" help exit fi if [ -z "$2" ] then echo "Missing parameters : username is needed\n" help exit fi if [ -z "$3" ] then echo "Missing parameters : password is needed\n" help exit fi echo "Login as $2 in cookie.txt" echo "$1 $2 $3" curl --header "Content-Type: application/json" --cookie-jar cookie.txt --request POST --data "{\"username\":\"$2\",\"password\":\"$3\"}" $1/api.php/login echo "\n"