PHP
  Home arrow PHP arrow Page 8 - Using Amazon Web Services With PHP And SOAP (part 1)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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 1)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 89
    2002-11-06


    Table of Contents:
  • Using Amazon Web Services With PHP And SOAP (part 1)
  • Remote Control
  • The Bare Necessities
  • Anatomy Class
  • The Bookworm Turns
  • Sorting Things Out
  • Turning The Pages
  • Weapon Of Choice
  • Hooking Up

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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 1) - Weapon Of Choice
    ( Page 8 of 9 )

    In addition to the BrowseNodeSearchRequest() call, which is kinda like a shotgun, AWS also allows you to laser in on a specific item via the ASINSearchRequest() method, which accepts an ASIN - Amazon's unique code for each product - and returns information on the corresponding item. Consider the following example, which demonstrates:











    <?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']), 'tag' => 'melonfire-20', 'type' => 'heavy', 'devtag' => 'YOUR-TOKEN-HERE' ); // invoke the method $result = $proxy->ASINSearchRequest($params); if($result['faultstring']) { echo $result['faultstring']; } else { $items = $result['Details']; // print the result print_r($result); } ?>
    Note the difference in the arguments passed to the method call - instead of a "browse_node" argument, this method used the "asin" argument, which specifies the ASIN to search for. This ASIN must be provided to the script above via the URL GET method, like this:

    http://your.server/asin.script.php?asin=0735712271
    Here's what the output of the script above looks like:

    Array ( [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/0735712271 [Asin] => 735712271 [ProductName] => XML and PHP [Catalog] => Book [Authors] => Array ( [0] => Vikram Vaswani ) [ReleaseDate] => 15 July, 2002 [Manufacturer] => New Riders Publishing [ImageUrlSmall] => http://images.amazon.com/images/P/0735712271.01.THUMBZZZ.jpg [ImageUrlMedium] => http://images.amazon.com/images/P/0735712271.01.MZZZZZZZ.jpg [ImageUrlLarge] => http://images.amazon.com/images/P/0735712271.01.LZZZZZZZ.jpg [ListPrice] => $39.99 [OurPrice] => $27.99 [UsedPrice] => $21.5 [ThirdPartyNewPrice] => $25.14 [SalesRank] => 29,310 [BrowseList] => Array ( [0] => Array ( [BrowseName] => XML (Document markup language) ) [1] => Array ( [BrowseName] => PHP (Computer program language ) [2] => Array ( [BrowseName] => Computer Programming Languages ) [3] => Array ( [BrowseName] => Computer Networks ) [4] => Array ( [BrowseName] => Computer Bks - Languages / Programming ) [5] => Array ( [BrowseName] => Computers ) [6] => Array ( [BrowseName] => Programming Languages - XML ) [7] => Array ( [BrowseName] => Programming - General ) [8] => Array ( [BrowseName] => Programming Languages - General ) [9] => Array ( [BrowseName] => Programming Languages - HTML ) [10] => Array ( [BrowseName] => Internet - General ) ) [Media] => Paperback [NumMedia] => 1 [Isbn] => 735712271 [Availability] => Usually ships within 24 hours [Reviews] => Array ( [AvgCustomerRating] => 3.8 [CustomerReviews] => Array ( [0] => Array ( [Rating] => 5 [Summary] => Lots Of Good Content, Examples [Comment] => i have bought both the wrox book and this one and much prefer this one. while the wrox book is good, i find this one to be much easier to understand, and to use as a base for my own projects. i am building an XML-based transaction server, and the chapters on DOM, WDDX and SOAP were very useful, as i was able to use some of the code from the book in my project without any difficulty. also i appreciated the chapters on using open-source alternatives to the built-in functions (this is again not available in wrox, which also tended to be infuriatingly vague at certain points).

    if you are a serious developer, i would recommend buying both books - i refer to both the wrox book and this one since neither one is exhaustive - but i learnt more from this one, as it is written in a clearer manner. ) [1] => Array ( [Rating] => 2 [Summary] => A questionable book... [Comment] => After all the flaky reviews this book has received, I was unsure if I was reading individual marketing campaigns sponsored by the various publishers or actual reviews. It seems that people cannot simply agree that this book is good or is bad as there is just nothing in between. Even in all the review cases, many people didn't find the reviews helpful, both positive and negative. It all seems complex from the consumer's perspective when deciding to buy this book.

    So given all these statements, I thought I'd present a true review - one from an actual reader rather than from someone else. I think it's pretty safe to assume that this book is good for some people and bad for others. The problem is that the reviews already here have so much fluff that they didn't even begin to describe themselves, thus they could be ambitious or lazy, smart or dim, and hobbyist or entrepreneurs. There is simply no way of telling.

    Personally, I think many of these concepts can be learned in PHP in about 2-3 days of trying the APIs out if you already know a great deal of XML. So if I'm going to buy a book on PHP and XML, I expect that it will provided added value information as well as design decisions, business concerns and best practices. Examples are not what I care about as much as the rich and deep information because there are many examples already on the web - no point acquiring the book just for those alone. That makes me question the reviewers who say the examples are clear and concise - the examples on the web already do that. Books are supposed to provide added value to these APIs and examples to make the topic complete and valuable to the reader. The book should also scale well to both beginning audiences (this book does very well) to expert audiences that want to drill through the basic information like APIs and examples and learn more advanced techniques, best practices, etc. This book doesn't deliver on these areas very well unfortunately.

    So, for a person like me: This book receives 2 stars. I didn't learn all that much from it and I was disappointed to say the least. He's a good writer, funny at times, and knows what he is doing, but he also catered to a specific audience and it shows. Is that the goal? Probably. But I think the expert people shouldn't have expected too much (as I did) - that's the truth.

    Although I personally give this book 2 stars, I believe that many beginner PHP programmers who have a little idea to what XML is will benefit from it. If you've already read some XML material on the net and even read a book or two, this book won't exactly help you out too much. However, this segment is rather small I would believe. I'm still looking for a book that I can give to my employees for reference as well as added value information. When I find it, I'll put a review there as well so you can compare.

    So there you have it - an honest review. I hope it helps people out in their purchasing decisions. ) [2] => Array ( [Rating] => 4 [Summary] => One of the best XML and PHP titles [Comment] => Most XML books suffer from painful verbosity. Useful information on a relatively simple subject tends to be hidden in drifts of useless cruft.

    This book focuses on the core information needed to become competent using XML and PHP together. While it is not the most comprehensive reference on XML available, it is the first resource that I check.

    (Disclosure: I worked on this book project as a technical reviewer - take what I say with your own grain of salt. :) ) ) ) [SimilarProducts] => Array ( [0] => 1861007213 [1] => 1861006918 [2] => 073570970X [3] => 672317842 [4] => 1565926102 ) ) ) )


    Wondering how I got so much extra data this time? That's because I told AWS I wanted the "heavy" form of the data, not the "lite" one I've been using thus far.

    In case you're curious, yes, I've used the sprintf() function call to reformat the ASIN to a ten-character zero-padded string. This is because AWS will return an error if the ASIN passed to it in a method call is less than ten characters in length.

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

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT