|MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA|
Hacking Amazon, Part 2
Hack #90: Create a Wireless Wish List
Take your Wish List wherever you go with AWS, XSLT, and WAP!
How many times have you been browsing at a bookstore or video store and you can't remember which books or movies you wanted to pick up? Sure, you could write them all down on a piece of paper and take it with you, but what fun would that be? Instead, you can use powerful cell networks and web applications to do the work for you. If you track wanted books and movies with your Amazon Wish List and have a WAP-enabled cell phone, you can always have your list handy.
WAP stands for Wireless Access Protocol, and it's used for delivering information to cell phones and other handheld devices. The information itself is formatted with WML (Wireless Markup Language), an XML format.
Just as HTML pages have
Making AWS responses available to a cell phone is just a matter of converting one XML format (AWS response) to another (WML). Once again, Amazon's XSLT service makes this quick work.
Create an XSL file called wap_wishlist.xsl with the following code:
There are a few important things to note in this code. First, the output type
has been set to WML with the
Running the Hack
The code is just an Amazon query, so we need to get the right URL. Find your Wish List ID [Hack #18] and include it in a wish list search like this:
Upload wap_wishlist.xsl to a publicly accessible
server and change the value of
There's just one more change that needs to be made. WAP browsers are looking
for a certain content type. Content types are specified as HTTP headers, and
there's no way to include those in our XSL file. Luckily, Amazon provides a way
to specify an alternate content type header with the query itself. Add the
That's all there is to it. Unfortunately this URL is a bit long to type into your phone with your keypad, but there are a couple of ways to work around this. First, see if your cell provider has a web interface for adding bookmarks to your phone's WAP browser. If so, you could copy and paste this monster into your cell provider's site, and then have 1-click (ahem) access through your phone's bookmarks. Another method is to upload a WML file to your site that contains a link to your wish list via this URL. Then you'd just need to browse to your own WAP page first and follow the link. If you go this route, try giving your WAP page a short name, like a.wml; this will save some keying.
Paul Bausch is a co-creator of the weblog software Blogger, maintains a directory of Oregon-based weblogs at ORblogs.com, and is the author of the forthcoming Yahoo! Hacks.
Return to the Web DevCenter.