PHP
  Home arrow PHP arrow Page 5 - Using Amazon Web Services With PHP And...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Using Amazon Web Services With PHP And SOAP (part 2)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 21
    2002-11-13

    Table of Contents:
  • Using Amazon Web Services With PHP And SOAP (part 2)
  • Rolling The Stones
  • Searching For Words
  • Drilling Deeper
  • Riding The Popularity Metrics
  • Bagging It
  • Linking Out

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using Amazon Web Services With PHP And SOAP (part 2) - Riding The Popularity Metrics


    (Page 5 of 7 )

    One of the things I've always liked about Amazon.com is its recommendations system - each time a customer makes a purchase, the Amazon.com system registers it and, keeping the customer's past purchases in context, evolves a database of customer likes and dislikes. This database is then used to provide other customers with a list of similar items ("...customers who purchased this item also bought..."), thereby serving the role of a very experienced sales person. It's a great system, works like a charm...and is now available to you via the AWS SimilaritySearchRequest() call.

    In order to demonstrate how this works, consider the following script:

    <?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); // uncomment the next line to see debug messages // $soapclient->debug_flag = 1; // create a proxy so that WSDL methods can be accessed directly $proxy = $soapclient->getProxy(); // set up an array containing input parameters to be // passed to the remote procedure $params = array( 'asin' => sprintf("%010d", $_GET['asin']), 'mode' => 'books', 'tag' => 'melonfire-20', 'type' => 'heavy', 'devtag' => 'YOUR-TOKEN-HERE' ); // invoke the method $result = $proxy->ASINSearchRequest($params); $items = $result['Details']; $simResult = $proxy->SimilaritySearchRequest($params); $simItems = $simResult['Details']; // display the result ?> <html> <head> <basefont face="Verdana"> </head> <body bgcolor="white"> <p>&nbsp;<p> <table width="100%" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="Navy"><font color="white" size="-1"><b>Welcome to The Mystery Bookstore!</b></font></td> <td bgcolor="Navy" align="right"><font color="white" size="-1"><b><? echo date("d M Y", mktime());?></b></font></td> </tr> </table> <p> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td align="center" valign="top" rowspan="7"><a href="<? echo $items[0]['Url']; ?>"><img border="0" src=<? echo $items[0]['ImageUrlMedium']; ?>></a></td> <td><font size="-1"><b><? echo $items[0]['ProductName']; ?></b></font></td> </tr> <tr> <td align="left" valign="top"><font size="-1">List Price: <? echo $items[0]['ListPrice']; ?></font></td> </tr> <tr> <td align="left" valign="top"><font size="-1">Amazon.com Price: <? echo $items[0]['OurPrice']; ?></font></td> </tr> <tr> <td align="left" valign="top"><font size="-1">Publisher: <? echo $items[0]['Manufacturer']; ?></font></td> </tr> <tr> <td align="left" valign="top"><font size="-1">Availability: <? echo $items[0]['Availability']; ?></font></td> </tr> <tr> <td align="left" valign="top"><font size="-1">Amazon.com sales rank: <? echo $items[0]['SalesRank']; ?></font></td> </tr> <tr> <td align="left" valign="top"><font size="-1">Average customer rating: <? echo $items[0]['Reviews']['AvgCustomerRating']; ?></font></td> </tr> <tr> <td colspan="2"> <font size="-1"> <hr> <? foreach($items[0]['Reviews']['CustomerReviews'] as $r) { ?> <b><? echo $r['Summary']; ?></b> <br> <? echo $r['Comment']; ?> <hr> <? } ?> </font> </td> </tr> <tr> <td colspan="2"> <font size="-1"> Customers who shopped for this item also bought: <ul> <? foreach($simItems as $s) { echo "<li><a href="" . $s['Url'] . "">" . $s['ProductName'] . "</a>"; } ?> </ul></font> </td> </tr> </table> </body> </html>
    The key to this script is the SimilaritySearchRequest() method call - this method accepts an ASIN (Amazon.com's unique code for each product) and returns a list of similar items, based on Amazon's customer purchase statistics, together with brief descriptive information. This information can then be formatted and displayed as a neat little addition to your product catalog - exactly what I've done above



    With the addition of the call to SimilaritySearchRequest(), the page now also includes helpful data on other customer's past purchases in the same context, together with links to the relevant product pages (notice how I'm using the returned ASIN's to re-invoke the same PHP script again, but with a different ASIN).

    More PHP Articles
    More By icarus, (c) Melonfire


     

       

    PHP ARTICLES

    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview
    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway