Filzhut.net Filzhut.net amazon_functions for PHP (Version 0.9)
Making the work with Amazon.com™ Web Services Version 1.0 much easier

amazon_search

Performs a search and returns an array with the parsed XML-result

amazon_search(var searchterm, int searchtype , int mode [, int type [, int page [, int format]]])

With this function you can query amazon™ for searchterms. The valid searchtype and the modes they can be used with are shown in the table below. The mode defines the mode the search results should have (f.e. "books" or "music"). Have a look at the table below to learn which searchtype is valid for which mode. If you want to search for more than one searchterm, please separate the words by space. Setting the type is optional: It gives you the possibility to determine the volume of the reply. LIGHT(default) returns less product-information than HEAVY.
A search you perform with this function returns up to 10 products. If you want to get more products, you can define that the result is not page #1(default), but f.e. page "2". So you don't receive the first 10 products, but products 11-20 - "3" would return the products 21-30...
If you are able to create XSL pages, you can set the URL of such a page as format (f.e. "http://www.yourserver.com/directory/file.xsl") and the result of this function won't be an array, but the XSL with the data the search returned.

Searchtype Valid modes
keyword books, music, classical, vhs, dvd, toys, baby, videogames, electronics, software, universal, garden, kitchen, photo, pc-hardware
author books
artist music, classical
actor vhs, dvd
director vhs, dvd
manufacturer books, music, classical, vhs, dvd, toys, baby, videogames, electronics, software, universal, garden, kitchen, photo, pc-hardware
asin books, music, classical, vhs, dvd, toys, baby, videogames, electronics, software, universal, garden, kitchen, photo, pc-hardware
upc music, classical

Example 1. Get products 1-10 from mode "book" with the keyword "cat":

$Reply=amazon_search("cat","keyword","books");

Example 2. Get products 11-20 from mode "vhs" by director "Steven Spielberg" in the heavy version (more data):

$Reply=amazon_search("Steven Spielberg","director","vhs","HEAVY","2");

If you want to know how to work with the array the search returnes, please have a look at Work with the search reply.


© by Filzhut.net, Daniel Filzhut 2002