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>";
}
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');
require '../lib/AmazonECS.class.php';
try {
    // get a new object with your API Key and secret key. Lang is optional.
    // if you leave lang blank it will be US.
    $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
    // The response contains now some information about this Node and its children, ancestors etc.
    // So we picked out one noteId of the childelements: 408306 -> Programmierung (Programming).
    // Now we want to browse this node
    $response = $amazonEcs->responseGroup('TopSellers')->browseNodeLookup(1);
    print_r($response);
    // Picking out one childNodeId again
    // 466484 -> Programmiersprachen (Programming languages)
    $response = $amazonEcs->browseNodeLookup(466484);
    //var_dump($response);
    // I think its enough now.. the basics should be clear. You can browse deeper and deeper this way.
    // Now we want to display the TopSellers in this node.
    // So we have to change the responseGroup.
    $response = $amazonEcs->responseGroup('BrowseNodeInfo,TopSellers')->browseNodeLookup(466484);
    //var_dump($response);
    // This is compatible with the associateTag feature. Feel free to use it here.
    $response = $amazonEcs->associateTag(AWS_ASSOCIATE_TAG)->browseNodeLookup(466484);
    //var_dump($response);
    // At this moment when i'm writing this this ASIN: 383621640X is the TopSeller in this Node
    // So i want to fetch all Infos about it.
    // I have to set back my responseGroup to e.g. Large then starting the lookup request:
    $response = $amazonEcs->responseGroup('Large')->lookup('383621640X');
    //var_dump($response);
    // If you want to use a nodeId combined with your search operation you can add the nodeId as parameter:
    // It is necessary to provide a category first.
    $response = $amazonEcs->category('Software')->responseGroup('Large')->search('PHP 5', 466484);
    //var_dump($response);
    // Searching something and returning some nodes found for this keyword.
    $response = $amazonEcs->responseGroup('BrowseNodes')->search('Visual Studio');
    //var_dump($response);
} catch (Exception $e) {
    echo $e->getMessage();