Created
January 8, 2014 14:02
-
-
Save nielsvanderbeke/8317158 to your computer and use it in GitHub Desktop.
Get meal voucher saldo from monizze card
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
###################################################################### | |
# script getMealVoucherSaldo.sh | |
# purpose Get meal voucher saldo from monizze card | |
# author Niels Vanderbeke | |
# date 20140108 | |
# parameters none | |
# changed at 20140108 | |
# changed by Niels Vanderbeke | |
###################################################################### | |
#---------------------------------------------------------------------- | |
# Variables | |
#---------------------------------------------------------------------- | |
email="****" | |
password="****" | |
url='https://www.monizze.be/en/login' | |
#---------------------------------------------------------------------- | |
# Execute request on webserver monizee.be and store respons in .temp.respons.xml | |
# URL : https://www.monizze.be/en/login | |
#---------------------------------------------------------------------- | |
curl -o .temp.respons.xml --silent --connect-timeout 5 --max-time 10 --retry 5 --fail --cookie-jar monizzecookie -sLe ';auto' -k -d "email=$email" -d "password=$password" -d 'submit=Login' "$url" | |
RETVAL=$? | |
#---------------------------------------------------------------------- | |
# Parse output .temp.respons.xml if webserice call was succesfull | |
#---------------------------------------------------------------------- | |
if [ $RETVAL -eq 0 ]; then | |
toparse=`cat .temp.respons.xml | sed '1,/Meal Voucher/d' | sed '/Card overview/,$d' | sed '1,/\<div\>/d' | sed '/\<div\>/,$d' | sed "s/^[ \t]*//" | sed 's/<strong>//g' | sed 's/<\/strong>//g' | sed 's/<br\/>/\n/g' | sed '/^$/d' | sed "s/^[ \t]*//"` | |
echo "$toparse" | |
fi | |
#---------------------------------------------------------------------- | |
# Cleanup | |
#---------------------------------------------------------------------- | |
rm .temp.respons.xml monizzecookie |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment