$amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'de', AWS_ASSOCIATE_TAG); // If you are at min version 1.3.3 you can enable the requestdelay. // This is usefull to get rid of the api requestlimit. // It depends on your current associate status and it is disabled by default. // $amazonEcs->requestDelay(true); // for the new version of the wsdl its required to provide a associate Tag // @see https://affiliate-program.amazon.com/gp/advertising/api/detail/api-changes.html?ie=UTF8&pf_rd_t=501&ref_=amb_link_83957571_2&pf_rd_m=ATVPDKIKX0DER&pf_rd_p=&pf_rd_s=assoc-center-1&pf_rd_r=&pf_rd_i=assoc-api-detail-2-v2 // you can set it with the setter function or as the fourth paramameter of ther constructor above $amazonEcs->associateTag(AWS_ASSOCIATE_TAG); // changing the category to DVD and the response to only images and looking for some matrix stuff. $response = $amazonEcs->category('DVD')->responseGroup('Large')->search("Matrix Revolutions"); //var_dump($response); // from now on you want to have pure arrays as response $amazonEcs->returnType(AmazonECS::RETURN_TYPE_ARRAY); // searching again $response = $amazonEcs->search('Bud Spencer'); //var_dump($response); // and again... Changing the responsegroup and category before $response = $amazonEcs->responseGroup('Small')->category('Books')->search('PHP 5'); //var_dump($response); // category has been set so lets have a look for another book $response = $amazonEcs->search('MySql'); //var_dump($response); // want to look in the US Database? No Problem $response = $amazonEcs->country('com')->search('MySql'); //var_dump($response); // or Japan? $response = $amazonEcs->country('co.jp')->search('MySql'); //var_dump($response); // Back to DE and looking for some Music !! Warning "Large" produces a lot of Response $response = $amazonEcs->country('de')->category('Music')->responseGroup('Small')->search('The Beatles');
include 'sampleSettings.php'; } defined('AWS_API_KEY') or define('AWS_API_KEY', 'API KEY'); defined('AWS_API_SECRET_KEY') or define('AWS_API_SECRET_KEY', 'SECRET KEY'); defined('AWS_ASSOCIATE_TAG') or define('AWS_ASSOCIATE_TAG', 'ASSOCIATE TAG'); defined('AWS_ANOTHER_ASSOCIATE_TAG') or define('AWS_ANOTHER_ASSOCIATE_TAG', 'ANOTHER ASSOCIATE TAG'); require '../lib/AmazonECS.class.php'; try { // get a new object with your API Key and secret key. // Added in version 1.0 is the new optional parameter to set up an AssociateTag (AssociateID) $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'DE', AWS_ASSOCIATE_TAG); /** * Now you can work the normal way with the class with the difference * that every URL in the response contains your AssociateTag */ $response = $amazonEcs->category('DVD')->responseGroup('Large')->search("Matrix Revolutions"); //var_dump($response); // searching again $response = $amazonEcs->search('Bud Spencer'); //var_dump($response); // Use the new Setter to update your AssociateTag on the fly $response = $amazonEcs->associateTag(AWS_ANOTHER_ASSOCIATE_TAG)->search('Bud Spencer'); //var_dump($response); // For more examples please look at testItemSearch.php and testItemLookup.php // These examples also could be used with the AssociateTag } catch (Exception $e) { echo $e->getMessage(); } if ("cli" !== PHP_SAPI) { echo "</pre>"; }