Home arrow PHP arrow Page 2 - Using Amazon Web Services With PHP And SOAP (part 2)

Rolling The Stones - PHP

In this concluding article, find out how to add search features to your AWS-backed online store, and link your product pages up to Amazon.com's shopping carts and wish lists.

  1. Using Amazon Web Services With PHP And SOAP (part 2)
  2. Rolling The Stones
  3. Searching For Words
  4. Drilling Deeper
  5. Riding The Popularity Metrics
  6. Bagging It
  7. Linking Out
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 21
November 13, 2002

print this article


The first - and the simplest - type of search available in AWS is the keyword search, exposed via the KeywordSearchRequest() call. Here's a simple example of how it works:

<?php // include class include("nusoap.php"); // create a instance of the SOAP client object $soapclient = new soapclient("http://soap.amazon.com/schemas2/AmazonWebServices.wsdl", true); // set up an array containing input parameters to be // passed to the remote procedure $params = array( 'keyword' => 'rolling%20stones', 'page' => 1, 'mode' => 'books', 'tag' => 'melonfire-20', 'type' => 'lite', 'devtag' => 'YOUR-TOKEN-HERE' ); // create a proxy so that WSDL methods can be accessed directly $proxy = $soapclient->getProxy(); // invoke the method $result = $proxy->KeywordSearchRequest($params); // print the results print_r($result); ?>
This is functionally similar to the scripts you've seen thus far; the primary difference lies in the call to a new function - KeywordSearchRequest() - and in the different arguments passed to it. The "keyword" argument passed to the function contains the words to be used as search keys in the specified Amazon catalog(s); note that this search term must be URL-encoded before being passed to the function.

Here's sample output from the script above:

Array ( [TotalResults] => 163 [Details] => Array ( [0] => Array ( [Url] => http://www.amazon.com/exec/obidos/redirect?tag=melonfire-20%26creative=Y OUR- TOKEN-HERE%26camp=2025%26link_code=sp1%26path=ASIN/1556523734 [Asin] => 1556523734 [ProductName] => Nankering With the Rolling Stones [Catalog] => Book [Authors] => Array ( [0] => James Phelge ) [ReleaseDate] => April, 2000 [Manufacturer] => A Cappella Books [ImageUrlSmall] => http://images.amazon.com/images/P/1556523734.01.THUMBZZZ.jpg [ImageUrlMedium] => http://images.amazon.com/images/P/1556523734.01.MZZZZZZZ.jpg [ImageUrlLarge] => http://images.amazon.com/images/P/1556523734.01.LZZZZZZZ.jpg [ListPrice] => $16.95 [OurPrice] => $11.87 [UsedPrice] => $10.95 ) ... snip ... ) )
Next, let's see how this can be integrated into the sample store I've been building.

>>> More PHP Articles          >>> More By icarus, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: