[Novalug] wget https request in a cron job - tracking Sprint Broadband card usage.
jecottrell3 at comcast.net
jecottrell3 at comcast.net
Thu Feb 25 19:00:43 EST 2010
Actually, it's even worse than that. Assuming that you are using bash, the ! character has to be escaped with a backslash...simple quotes won't prevent the history mechanism from occurring.
There is a bash variable to reset the history characters and probably some options to turn it off altogether...go look them up.
Perhaps you'd like to replace the ! (and other) chars with %21 (and their equivalents.
I'd also build the URL in stages....something like
URL="start"
URL="${URL}more stuff"
and finally do something like
wget "$URL"
protecting the substituted URL.
JIM
P.S. Yes, I know that variable substitution doesn't need extra quotes, but they are nice.
----- Original Message -----
From: "Jeff Stoner" <leapfrog at freeshell.org>
To: "Miles D. Oliver" <miles.d.oliver at gmail.com>
Cc: "Novalug LUG" <Novalug at calypso.tux.org>
Sent: Thursday, February 25, 2010 1:21:13 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Novalug] wget https request in a cron job - tracking Sprint Broadband card usage.
On Thu, 25 Feb 2010, Miles D. Oliver wrote:
> https://manage.sprintpcs.com/Manage/myportal/!ut/p/c1/04_SB8K8xLLM9MSSzPy8xBz9CP0os3hPZ3fHQE8TIwMLY29TAyMfLxcDJwNjo8AQA6B8JE55_zADArrDQfbhVBHsYYZXHmw-SN4AB3A00PfzyM9N1S_IjTDIDEhXBACHtDT5/dl2/d1/L2dJQSEvUUt3QS9ZQnB3LzZfSUNHQVFJNDIwODNLNTAyTEpEMEIwMzJRTDI!/?selectedUsageMin=OURPHONENUMBER&forceAction=true&INTNAV=MU:PP:20090620:UsageDetails:DLSM
>
> (OURPHONENUMBER substitued for our real number)
>
> I'm trying to script this to capture the output and send her alerts when her
> free bytes are getting low.
>
> Ive successfully used wget to login get the cookie information and keep it
> in a file. However when I attempt to get the results if the usage report I
> fall short.
>
> wget --post-data="Username=OURID&password=OURPASSWORD" --cookies=on
> --keep-session-cookies --save-cookies=cookie.txt
> https://sso.sprintpcs.com/sso/SignOn.do
> wget --keep-session-cookies --load-cookies=cookie.txt
> https://manage.sprintpcs.com/Manage/myportal/!ut/p/c1/04_SB8K8xLLM9MSSzPy8xBz9CP0os3hPZ3fHQE8TIwMLY29TAyMfLxcDJwNjo8AQA6B8JE55_zADArrDQfbhVBHsYYZXHmw-SN4AB3A00PfzyM9N1S_IjTDIDEhXBACHtDT5/dl2/d1/L2dJQSEvUUt3QS9ZQnB3LzZfSUNHQVFJNDIwODNLNTAyTEpEMEIwMzJRTDI!/?selectedUsageMin=OURPHONENUMBER&forceAction=true&INTNAV=MU:PP:20090620:UsageDetails:DLSM
>
> The output of the 2nd wget is just a
> https://sso.sprintpcs.com/sso/Login.do login
> page so Im not keeping my session information.
Are you putting single quotes around the URL? If you don't, the shell will
parse it and do it's voodoo. The '!', ':', '?' and '&' have special
meaning to the shell.
> Any thoughts on how to debug this https session with wget to get the results
> Im looking for or point me to any debugging info?? my google queries are
> falling short.
>
> I've not used wget much other than to pull files.
I'm a big fan of using Perl and LWP for such things.
--Jeff
"You cannot unsay a cruel word." - Unknown
_______________________________________________
Novalug mailing list
Novalug at calypso.tux.org
http://calypso.tux.org/mailman/listinfo/novalug
More information about the Novalug
mailing list