This post is obsolete. See the updated post.

Since AVH Amazon plugin no longer works, as Amazon in its infinite wisdom removed the ListLookup API call, I had to create my own. Without an API, I resorted to a hacker's best friend: screen scraping. The wishlist page has a simple structure, and all links to Amazon products have as part of the URL "dp/{ASIN}", where {ASIN} is the Amazon ID number. If you view a wishlist in compact form, then the only links are to wishlist items and all the items (as far as I can tell) will be on a single page. Other advertisements for Amazon products that you see on the page are added with Javascript, so they won't show up when we grab the page with PHP.

So it's easy to get a list of ASIN's of the products on my wishlist:

function wishlist($listname){
	$url = "$listname?layout=compact";
	$contents = file_get_contents($url);
	preg_match_all ('|/dp/(\w+)/|', $contents, $ASINs, PREG_PATTERN_ORDER);
	return $ASINs[1]; // just get the numbers

This returns an array of ASIN's, that you can now pass the the Amazon ItemLookup API, which still works fine (Ulrich Mierendorff's AWS Signed Query makes that easy).

If your web hosting service disables file_get_contents, as mine does, you can use cURL instead.

As you can see from my sidebar, it seems to work well. Obviously, Amazon can change the layout and content of their pages without notice, but as we have seen, they can change the API as well.


  1. Fredyy says:

    Thank you, this really helped me out, i was searching for an alternative since they blocked ListLookUp

  2. Lior says:


    Look great.. only – what do you use for list name?

  3. Danny says:

    The permalink to your wishlist is something like or shortened to
    The list ID is the alphanumeric stuff at the end. Unfortunately, Amazon doesn’t show that automatically anymore when you look at your wishlist, but you can see it if you click on “Share With Friends”, or when you search for a wishlist (it returns a URL that ends with ?...&id=1PUA0GNXIWGBK.
    You could also go back to screen scraping and search the source of your wishlist page for /\/wishlist\/(\w+)\// (that’s “/wishlist/listID/“).
    Amazon doesn’t have an API for looking up ID’s, but if you request the URL
    it will return the URL, so you could probably create your own look up function.
    Hope this helps (and feel free to use the above list ID to buy me a present!)

  4. Danny says:

    OK, that intrigued me enough to write a quick PHP routine to find a wishlist based on the email address (only works if the person has only one wishlist):

    function wishlistid($email){
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, "$email");
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_HEADER, true);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
      preg_match('/type=wishlist&id=(\w+)/', curl_exec($ch), $match);
      return $match[1];
  5. Mauro Asprea says:

    You can also get the RSS feed of your Amazon Wish List using the service I built for such purpose: Wish and BAM

    Then you can parse the RSS with the php DOM library

    Please let me know if this works for you guys!

  6. Danny says:

    @Marco Asprea:
    How are you grabbing the wishlist information without the Amazon API?

  7. Mauro Asprea says:

    @Danny the same way google knows about the internet: Crawling ;)

    Let me know if you want some early access to try things out. I am building a simple interface for devs to generate a RSS feed given a Wish List URL. follow me on Twitter @wishandbam or @brutuscat and let me know ;)

  8. Danny says:

    Ah, so you’re looking at the HTML pages as well. I hoped you had some secret access to the API that would be easier.

  9. Mauro Asprea says:

    Last week I wrote How to get an RSS feed out of my Amazon Wish List?

    This way u can use your Amazon Wish List with your RSS Plugins/Widgets

  10. Danny says:

    The twitter trick looks cool. I don’t have a twitter account (it’s blocked at work and I hardly have time to look at the computer otherwise) but it may be worth it to play with the wishlist feed.

  11. Searching your Wish List « Code In Chinese says:

    […] recently removed wish list querying methods from their API. Bummer. Then I came upon this post. . The solution is the layout=compact URL […]

Leave a Reply

Warning: Undefined variable $user_ID in /home/public/blog/wp-content/themes/evanescence/comments.php on line 75