The Ann Arbor library makes it easy to renew your library books; it's one click once you've logged in. I thought I'd make it zero clicks. Here's how.
I'm on a Mac running Firefox, so I have two tools at my disposal: "curl", a command line tool for making web requests, and Firebug, a debugger for Firefox that gives you a ton of page information. The v1.2 version of Firebug works with Firefox 3.0, so make sure your versions are in sync. curl is stable and widely distributed on many systems (including MS-DOS and Amiga!) so that should be easy; there's a similar tool "wget" which should be a substitute.
With those two I was able to come up with this (edited very slightly so that it won't work for you):
#!/bin/sh
# renew all items
curl -b "PHPSESSID=b93f03330de3fe399e2e9659fc2c5898" \
-d "itemsformsub=1&renewall_button=Renew+All+Items" \
https://www.aadl.org/user/890
I'll decode this for you to replicate this yourself, or more to the point so I remember what the heck I did (and I can only imagine a handful of people who this is for, but just to bear with me in case one of them comes up with a better idea!)
The first -b argument takes a PHP session ID key, which is the cookie that the AADL site uses to authenticate you. I dug that out of the page with Firebug, or you can find it without that under Tools / Page Info / Security / View Cookies. The expiration date on that particular cookie was less than a month away, so this script will have to be fixed up periodically with a new auth key.
The second -d argument takes the form information to fill out. In this case Firebug showed me the form on the page that I was looking to fill out, and once I had turned on "Net" debugging it gave me all of the fields I needed to send on the "post" tab of the POST transaction.
The final argument is the page to post to, in this case my user id number on the site.
The command produces (prodigious) output, which I should next parse I suppose to tell me which books to read, which ones to find, and all that - all in good time.
The same approach (with all of the details changed, but the same tools) could work for you if your library system has a web based way to renew books.
Recent Comments