O'Reilly logo

Amazon Hacks by Paul Bausch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Add Multiple Items to a Wish List at Once

Speed up the process of adding items to your wish list with a bit of scripting.

Creating a wish list with 15-20 products is usually a slow process, adding one or two items while you’re browsing. Amazon doesn’t offer an interface for adding multiple items to a wish list, but you can build one with a bit of scripting. This PHP script accepts a comma-separated list of ASINs and adds them to your wish list all at once.

What You Need

This script relies on automatic form posts, and there are some external PHP tools to speed up this kind of development. Snoopy for PHP is an open source class that handles HTTP requests. You can download a copy from SourceForge (http://sourceforge.net/projects/snoopy/) and include it in the same directory as this script.

The Code

This script runs as a web page and presents a simple form for entering ASINs. Once you enter a list of ASINs, this script performs three main actions:

  1. With the Snoopy PHP class, it simulates a Sign In form post at Amazon with your email address and password to retrieve a session ID.

  2. It then loops through the ASINs.

  3. For each ASIN, it uses Snoopy to send a form post with the variables from the remote wish list form [Hack #19].

Because you need to be signed in to add items to your wish list, the key to this script is obtaining a 17-digit Amazon session ID [Hack #13] that is associated with your account when you visit the site. Be sure to include your email address and Amazon password in the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required