public function CoverSearch($nameSong)
 {
     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('AKIAJ45XKTAZEFQWMN3Q', 'VwUj6FDtpTu/JcAl6cLsGfw0eQIc2A3uvhYv3mYv', 'de', 'ASSOCIATE TAG');
         $this->cover = $amazonEcs->returnType('1')->country('de')->category('All')->responseGroup('Small,Images')->search($nameSong);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
Пример #2
0
 function Amzecs()
 {
     $this->CI =& get_instance();
     $this->CI->load->database();
     $this->CI->config->load('db_tables');
     $db_tables = $this->CI->config->item('db_tables');
     $db_tables = $db_tables[$db_tables['environment']];
     $mysql_tables = $db_tables['mysql'];
     foreach ($mysql_tables as $name => $table) {
         $this->{'_table_' . $name} = $table;
     }
     $accessKey = $this->CI->config->item('amazon_ecs_access_key');
     $secretKey = $this->CI->config->item('amazon_ecs_secret_key');
     $countryCode = $this->CI->config->item('amazon_ecs_country');
     $associateTag = $this->CI->config->item('amazon_ecs_associate_tag');
     parent::__construct($accessKey, $secretKey, $countryCode, $associateTag);
     //require_once(dirname(BASEPATH).'/system/application/libraries/httpSockets.class.php');
     //we are not going to attempt to use PEAR...
     require_once 'HTTP/Request2.php';
     $this->cookies = array();
     $this->agents = array('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1); Trident/5.0', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8) Gecko/20051107 Firefox/1.5', 'Opera/9.80 (Macintosh; Intel Mac OS X 10.8.2) Presto/2.12.388 Version/12.14', 'Opera/9.0 (Windows NT 5.0; U; en)');
     $this->warn_max = $this->CI->config->item('warn_max');
     $this->warn_minutes = $this->CI->config->item('warn_minutes');
     $this->warn_period = $this->CI->config->item('warn_period');
 }
            // update postmeta meta_key=_sku,_price,
            add_post_meta($postID, '_sku', $product->asin);
            add_post_meta($postID, '_price', $product->price);
            add_post_meta($postID, '_stock', $product->available);
        }
    }
} elseif (isset($_POST['getamazon'])) {
    require dirname(__FILE__) . '/../AmazonECS_133/Exeu-Amazon-ECS-PHP-Library-1867eaa/lib/AmazonECS.class.php';
    try {
        $awsapikey = get_option('awsapikey');
        $awsapisecretkey = get_option('awsapisecretkey');
        $awsassociatetag = get_option('awspa_associatetag');
        $markup = get_option('awspa_markup');
        $category = $_POST['category'];
        $catname = $category;
        $amazonEcs = new AmazonECS($awsapikey, $awsapisecretkey, 'com', $awsassociatetag);
        $response = $amazonEcs->category('All')->responseGroup('ItemAttributes,Offers,Images,Reviews')->search($category);
        $products = array();
        $i = 0;
        foreach ($response->Items as $item) {
            if (is_array($item)) {
                foreach ($item as $product) {
                    $prod = $product->ItemAttributes->Title;
                    $prodcode = $product->ASIN;
                    $listprice = number_format(floatval(preg_replace('/[\\$,]/', '', $product->ItemAttributes->ListPrice->FormattedPrice) * $markup), 2);
                    $avail = $product->Offers->TotalOffers;
                    $brand = $product->ItemAttributes->Brand;
                    $manufacturer = $product->ItemAttributes->Manufacturer;
                    $sku = $product->ItemAttributes->SKU;
                    $upc = $product->ItemAttributes->UPC;
                    $reviews = $product->ItemAttributes->CustomerReviews->IFrameURL;
Пример #4
0
<?php

include 'sampleSettings.php';
require 'AmazonECS.class.php';
require_once "lib/phpfastcache.php";
$cache = phpFastCache();
$amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'com', AWS_ASSOCIATE_TAG);
$amazonEcs->associateTag(AWS_ASSOCIATE_TAG);
//MYSQL
$mysqli = new mysqli("localhost", "root", "", "books");
if ($mysqli->connect_error) {
    die('Connect Error: ' . $mysqli->connect_error);
}
//API vars
$r_list_name = "Combined Print and E-Book Fiction";
$n_date = array();
$filter_sql = '';
if (isset($_GET["date"]) && $_GET["date"] != '') {
    $filter_sql = "  AND published_date <='" . $_GET["date"] . "'";
}
//SQL 1
$result = $mysqli->query("SELECT published_date FROM ranks where list_name= '" . $r_list_name . "' " . $filter_sql . " group by published_date order by published_date desc limit 2");
while ($aditional = $result->fetch_assoc()) {
    array_push($n_date, $aditional);
}
// latest list date based on list name in $r_list_name
$list_date = $n_date[0]['published_date'];
$next_list_date = $n_date[1]['published_date'];
//var holder for output
$json = array('list_date' => $list_date, 'next_list_date' => $next_list_date, 'list_name' => $r_list_name, 'books' => []);
//SQL 2
Пример #5
0
$dotd_url = 'https://affiliate-api.flipkart.net/affiliate/search/json?query=' . $query2 . '&resultCount=9';
//Call the API using the URL.
$details = $flipkart->call_url($dotd_url);
if (!$details) {
    echo 'Error: Could not retrieve products list.';
    exit;
}
//The response is expected to be JSON. Decode it into associative arrays.
$details = json_decode($details, TRUE);
$products = $details['productInfoList'];
echo "<table border=2 cellpadding=10 cellspacing=1 style='text-align:center'>";
$count = 0;
$end = 1;
$i = 1;
try {
    $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'in', AWS_ASSOCIATE_TAG);
    $amazonEcs->associateTag(AWS_ASSOCIATE_TAG);
    $response = $amazonEcs->country('in')->category('All')->search($query);
    //Make sure there are products in the list.
    if (count($products) > 0) {
        foreach ($products as $product) {
            //Hide out-of-stock items unless requested.
            if ($count % 2 == 0) {
                $inStock = $product['productBaseInfo']['productAttributes']['inStock'];
                if (!$inStock) {
                    continue;
                }
                //Keep count.
                //The API returns these values nested inside the array.
                //Only image, price, url and title are used in this demo
                $productId = $product['productBaseInfo']['productIdentifier']['productId'];
/**
 * For a running Search Demo see: http://amazonecs.pixel-web.org
 */
if ("cli" !== PHP_SAPI) {
    echo "<pre>";
}
if (is_file('sampleSettings.php')) {
    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');
require '../lib/AmazonECS.class.php';
try {
    $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'DE', AWS_ASSOCIATE_TAG);
    // 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);
    // Looking up multiple items
    $response = $amazonEcs->responseGroup('Large')->optionalParameters(array('Condition' => 'New'))->lookup('B0017TZY5Y, B004DULNPY');
    //var_dump($response);
    $response = $amazonEcs->responseGroup('Images')->lookup('B0017TZY5Y');
    //var_dump($response);
} catch (Exception $e) {
    echo $e->getMessage();
}
if ("cli" !== PHP_SAPI) {
    echo "</pre>";
}
<?php

include '../../settings.php';
try {
    $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'US');
    // First of all you have to set an another ResponseGroup. If not the request would not be successful
    // Possible Responsegroups: BrowseNodeInfo,MostGifted,NewReleases,MostWishedFor,TopSellers
    $amazonEcs->responseGroup('BrowseNodeInfo');
    // Then browse a node like this:  nodeId (See: http://docs.amazonwebservices.com/AWSECommerceService/2010-09-01/DG/index.html?BrowseNodeIDs.html)
    // For example: 542064 on German Amazon is: Software
    $response = $amazonEcs->browseNodeLookup(1000);
    print_r($response);
    // 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.
<?php

if ("cli" !== PHP_SAPI) {
    echo "<pre>";
}
if (is_file('sampleSettings.php')) {
    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');
require '../lib/AmazonECS.class.php';
try {
    $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'DE');
    $response = $amazonEcs->responseGroup('Large')->similarityLookup('B0017TZY5Y');
    //var_dump($response);
    $response = $amazonEcs->responseGroup('Images')->similarityLookup('B0017TZY5Y');
    //var_dump($response);
} catch (Exception $e) {
    echo $e->getMessage();
}
if ("cli" !== PHP_SAPI) {
    echo "</pre>";
}
Пример #9
0
  public function requestDelay($enable = null)
  {
    if (false === is_null($enable) && true === is_bool($enable))
    {
      $this->requestConfig['requestDelay'] = $enable;

      return $this;
    }

    return $this->requestConfig['requestDelay'];
  }
}



    
		   define('AWS_API_KEY', 'AKIAJU2GXE5GKCFCHDVA');
		   define('AWS_API_SECRET_KEY', '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');
		   define('AWS_ASSOCIATE_TAG', 'ASSOCIATE TAG');
		   define('AWS_ANOTHER_ASSOCIATE_TAG', 'ANOTHER ASSOCIATE TAG');    
    
    // Verbindung zu Amazon herstellen
       $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'DE', AWS_ASSOCIATE_TAG);

    // 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);
    
    // from now on you want to have pure arrays as response
       $amazonEcs->returnType(AmazonECS::RETURN_TYPE_OBJECT);
Пример #10
0
<?php

echo "<pre>";
include 'settings/settings.php';
require 'lib/AmazonECS.class.php';
try {
    $ecs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'com', AWS_ASSOCIATE_TAG);
    $ecs->responseGroup('BrowseNodeInfo,TopSellers');
    $response = $ecs->browseNodeLookup(229534);
    echo print_r($response->BrowseNodes->BrowseNode->TopSellers->TopSeller[0]);
    $response = $ecs->responseGroup('Similarities')->lookup($response->BrowseNodes->BrowseNode->TopSellers->TopSeller[0]->ASIN);
    echo print_r($response);
} catch (Exception $e) {
    echo $e->getMessage();
}
echo "</pre>";
Пример #11
0
<?php

session_start();
require 'src/AmazonECS.php';
//nom de la classe téléchargée
const Aws_ID = "AKIAJ5TGZU744CQHFQFA";
// Identifiant
const Aws_SECRET = "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";
//Secret
const associateTag = "190571010520";
// AssociateTag
$client = new AmazonECS(Aws_ID, Aws_SECRET, 'FR', associateTag);
require 'include/header.php';
?>
    <div class="container">
        <br><br><br>
        <?php 
$asin = $_GET['ASIN'];
if ($asin != null) {
    //$response = $client->responseGroup('Large')->lookup($title);
    $response = $client->responseGroup('Large')->lookup($asin);
    $items = $response->Items;
    if (empty($response->Items->Item)) {
        echo "Le code ASIN est n'est pas ou plus valable.";
    } else {
        $item = $items->Item;
        echo '<h2>' . $item->ItemAttributes->Title . '</h2>';
        echo '<p><a href="' . $item->DetailPageURL . '" target="_blank">Lien Amazon</a></p>';
        //
        echo '<div class="row"><div class="col-lg-6">';
        echo '<br><p>Quelques informations:</p><br>';
<?php

/**
 * For a running Search Demo see: http://amazonecs.pixel-web.org
 */
if ("cli" !== PHP_SAPI) {
    echo "<pre>";
}
if (is_file('sampleSettings.php')) {
    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');
require '../lib/AmazonECS.class.php';
try {
    $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'DE', AWS_ASSOCIATE_TAG);
    // 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);
    $response = $amazonEcs->responseGroup('Large')->similarityLookup('B0017TZY5Y');
    //var_dump($response);
    $response = $amazonEcs->responseGroup('Images')->similarityLookup('B0017TZY5Y');
    //var_dump($response);
} catch (Exception $e) {
    echo $e->getMessage();
}
if ("cli" !== PHP_SAPI) {
    echo "</pre>";
}
Пример #13
0
function wfGetAmazonAWS($query, $callback)
{
    $AWS_API_KEY = '0G5V6FHQXQ1JREGFZVR2';
    $AWS_API_SECRET_KEY = '8oxghQ9SKjZCnGc8tvjMyVR0aAj7rRJfw7w99cRK';
    $AWS_ASSOCIATE_TAG = 'zerosixtycorp-20';
    require '../common/AmazonECS.class.php';
    $amazonEcs = new AmazonECS($AWS_API_KEY, $AWS_API_SECRET_KEY, 'com', $AWS_ASSOCIATE_TAG);
    $response = $amazonEcs->responseGroup('Small,Images')->search($query);
    //    	var_dump($response);exit;
    if ($callback) {
        return $callback . "(" . $response . ")";
    } else {
        return $response;
    }
}
 */
if ("cli" !== PHP_SAPI) {
    echo "<pre>";
}
if (is_file('sampleSettings.php')) {
    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) {
 public function CoverSearch($nameSong)
 {
     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('AKIAJ45XKTAZEFQWMN3Q', 'VwUj6FDtpTu/JcAl6cLsGfw0eQIc2A3uvhYv3mYv', 'de', 'ASSOCIATE TAG');
         //foreach ($nameSong as $song){
         $this->cover = $amazonEcs->returnType('1')->country('de')->category('All')->responseGroup('Small,Images')->search($nameSong);
         //$track = $amazonEcs->returnType('1')->country('de')->category('All')->responseGroup('Tracks')->search($nameSong);
         //var_dump($track['Items']['Item']);
         //return $this->cover;
         //}
         /*        $response = $amazonEcs->returnType('1')->country('de')->category('All')->responseGroup('Small,Images')->search('Fields Of The Nephilim - Requiem Xiii-33 (Le Veilleur Silencieux)');
                              //var_dump($response);
                             if (isset($response['Items']['Item']) ) {
         
                                 if (isset($response['Items']['Item'])) {
         
                                     //loop through each item
                                     foreach ($response['Items'] as $result) {
                                         //var_dump($result['ItemLinks']);
         
                                         //check that there is a ASIN code - for some reason, some items are not
                                         //correctly listed. Im sure there is a reason for it, need to check.
                                         if (isset($result['ASIN'])) {
         
                                             //store the ASIN code in case we need it
                                             $asin = $result['ASIN'];
                                             print_r($asin);
                                             //check that there is a URL. If not - no need to bother showing
                                             //this one as we only want linkable items
                                             if (isset($result['DetailPageURL'])) {
         
                                                 //set up a container for the details - this could be a DIV
                                                 echo "<p min-height: 60px; font-size: 90%;'>";
         
                                                 //create the URL link
                                                 echo "<a target='_Blank' href='" . $result['DetailPageURL'] . "'>";
         
                                                 //if there is a small image - show it
                                                 if (isset($result['SmallImage']['URL'])) {
         
                                                     echo "<img src='" . $result['SmallImage']['URL'] . "'>";
         
                                                     echo "<h3>". $result['SmallImage']['URL'] . "</h3>";
                                                 }
         
                                                 // if there is a title - show it
                     //                            if (isset($result['ItemAttributes']['Title'])) {
                     //                                //var_dump($result);
                     //                                echo "<h2>" . $result['ItemAttributes']['Title'] . "</h2>";
                     //                                echo "<h2>" . $result['ItemAttributes']['Creator']['_'] . "</h2><br/>";
                     //                            }
         
                                                 //close the paragraph
                                                 echo "</a></p>";
         
                                             }
                                         }
                                     }
                                 }
                             }*/
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
 * For a running Search Demo see: http://amazonecs.pixel-web.org
 */
if ("cli" !== PHP_SAPI) {
    echo "<pre>";
}
if (is_file('sampleSettings.php')) {
    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');
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');
Пример #17
0
// get a new object with your API Key and secret key. Lang is optional.
if ($_REQUEST['search']) {
    header('Content-Type: application/json');
    $store = $_REQUEST['store'];
    $store = trim($store, ". ");
    //some people put ".co.jp" in the store so strip out any leading .
    $tag = $_REQUEST['affiliate'];
    if (!$tag) {
        $tag = AWS_ASSOCIATE_TAG;
    }
    //use my tag if one is not supplied by the client
    $searchquery = $_REQUEST['search'];
    $type = $_REQUEST['type'];
    //for future use, at the moment searches All could be DVD or Books or other categories
    //this is where the magic happens
    $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, $store, $tag);
    $response = $amazonEcs->category($type)->responseGroup('Medium')->search($searchquery);
    echo json_encode($response->Items);
    //magic over. The rest is just presenting a web page for curious people arriving with a browser
} else {
    ?>
<html>
<body>
<h1>Shopping Search</h1>
<p>This web service proxies the Amazon API for a Gnome Shell search provider An example call would be:</p>

<p><a href="https://products.libertus.co.uk/?search=pink%20bunnies%20pen&type=All&store=co.uk&affiliate=theopensou-21">http://products.libertus.co.uk/?search=pink%20bunnies%20pen&type=All&store=co.uk&affiliate=theopensou-21</a></p>
<p>The tool itself can be installed from <a href="https://extensions.gnome.org/extension/564/amazon-shopping/">the Gnome extension collection</a></p>
<p>This is a <a href="http://libertus.co.uk">Libertus Solutions</a> service. We are not interested in the search queries, most of the time they won't be logged or looked at
although we might from time to time do some sample logging to see how much it is used and whether we need to dedicate more server power to it.</p>
<p>You can read more about the development of this service <a href="http://www.theopensourcerer.com/2012/12/privacy-is-hard-lets-go-shopping/">here</a>