I would like to use wget or curl in a script to obtain the data usage and number of days left for a T-Mobile data line.
I know there are a couple of interactive ways to get data usage via SMS or from the T-Mobile website. This is for a remote computer connected by Ethernet to a cellular modem that could better manage its Internet access if it could query for data usage and days left.
1) Is there a special URL that returns mainly those results without the verbiage aimed at an interactive user?
2) If not, does anyone have an example of using wget or curl, or a script, that can be used to login to a T-Mobile account, get the data usage web page, and parse it for the just the data usage/days left?
I have tried:
and got back a web page that maybe is telling me that cookies are not enabled and asking for a username/password.
The wget documentation has information that might work describing a process involving two wget calls:
1) one wget call to login:
wget --save-cookies cookies.txt \
--post-data 'user=foo&password=bar' \
2) and a second call to get the data:
# Now grab the page or pages we care about.
wget --load-cookies cookies.txt \
To find the authorization URL I looked at a login screen that T-Mobile presented to me:
Not as simple the the wget example. There are redirects - is all of that URL necessary? Also there is a "client id" that was automatically or previously generated? Do I need a prior wget call to get a client id?
I would appreciate help if anyone has already worked through this or knows what URL's and arguments to use?