A couple weeks ago, I put forward a method to see your LesNet account balance at your Aastra phone.
I also posted to the Taug.ca mail list for suggestions on web scraping from secure sites. Well, it turns out the Virgin doesn’t consider security a high priority, but challenging scrapers is….or should I say WAS.
If you’re like me, you’d like to know well in advance of getting that Beep and disconnect message on a $0 balance phone, or the SMS from them when you have 3 minutes of talk time left on your account…aka $1 left on the balance. Now, a qiuck glance at your phone…(Aastra at least until someone hacks my code for another set), and you’re off (maybe to buy a phone card…), knowing you’ve got a reasonable balance to start another day
Next, download the tar file VIRGINMOBILE_Balance.tar and untar it. Much like the previous LESNET balance article, this one has the LESNET balance line (remove it if you don’t have the LESNET scripts running from the past article) as well as two accounts I monitor. I’ve simplified them to read VM_LABEL1 and VM_LABEL2. Change the labels to something appropriate as this is what will display on your set. Move these to your aastra folder in your web (likely /var/www/aastra or /var/www/html/aastra) or if you’ve already customized REGISTER.PHP and ONHOOK.PHP, duplicate those lines in your files as appropriate.
Next, move the virginbalanceupdate.sh file to a scripts folder (I use /root/monitor for these files) and create some time of trigger – a daily or periodic cron file (I run mine at 4am and 4pm). Edit this file for the labels (per your onhook and register files) and to replace the NXXNXXXXXX with your phone numbers (note there are two lines to do two accounts) and YOURPIN with the pins for your respective accounts. Adjust the number of accounts as needed in the various files. In my case, both mine and my wife’s are monitored.
Next, sit back and watch the screen scroll the data.
UPDATE 2010-04-08 This no longer works as of the past couple of weeks. A 404 error is now returned. I guess they decided to up their security a bit, to the inconvenience of apps like this. That said, it serves as a good example of the simplicity a data scraping model can use.