#!/bin/sh

# Connect to Spreadshirt
# inputs:   
#			$1 language (en)
#			$2 login (email address; also used to generate unique filenames)
#			$3 password
# returns:
#			0: ok

# login and get cookies
# -o <file> = output file
# -s = silent
# -c <file> = store cookies there
# -d <name=value> = POST name/value
curl -o $2.tempfile.html -s -c $2.cookies -d op=login_handle -d login=$2 -d password=$3 "https://www.spreadshirt.com/54.0.html"

# get totals
# -L = (Location) follow any redirects/pagemoves
# -o <file> = output file
# -s = silent
# -b <file> = use this cookie file
curl -L -o $2.salesreport.txt -s -b $2.cookies "https://www.spreadshirt.com/My_Shop.7.0.html"

# success FIXME make this actually test something; like, non-empty file
echo 0

