Services_Amazon
[ class tree: Services_Amazon ] [ index: Services_Amazon ] [ all elements ]

Class: Services_AmazonECS4

Source Location: /Services_Amazon-0.7.1/AmazonECS4.php

Class Overview


Class for accessing and retrieving information from Amazon's Web Services


Author(s):

Version:

  • Release: 0.7.1

Methods


Inherited Variables

Inherited Methods


Class Details

[line 101]
Class for accessing and retrieving information from Amazon's Web Services
  • Author: John Downey <jdowney@gmail.com>
  • Author: Tatsuya Tsuruoka <ttsuruoka@p4life.jp>
  • Version: Release: 0.7.1
  • Access: public
  • Uses: XML_Unserializer
  • Uses: HTTP_Request
  • Uses: PEAR


[ Top ]


Method Detail

Services_AmazonECS4 (Constructor)   [line 228]

Services_AmazonECS4 Services_AmazonECS4( string $keyid, [string $associd = null])

Constructor

Parameters:

string   $keyid   —  An Amazon Access Key ID used when quering Amazon servers
string   $associd   —  An Amazon Associate ID used in the URL's so a commision may be payed

[ Top ]

BrowseNodeLookup   [line 494]

array BrowseNodeLookup( string $browsenode_id, [array $options = array()])

Retrieves information about a browse node

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $result $amazon->BrowseNodeLookup('283155')// 283155='Books'
  4.  ?>

  • Return: The array of information returned by the query
  • Access: public

Parameters:

string   $browsenode_id   —  The browse node ID
array   $options   —  The optional parameters

[ Top ]

CartAdd   [line 525]

array CartAdd( string $cart_id, string $hmac, array $item, [array $options = array()])

Adds items to an existing remote shopping cart

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $item = array('ASIN' => 'aaaaaaaaaa''Quantity' => 1);
  4.  // $item = array(array('ASIN' => 'aaaaaaaaaa', 'Quantity' => 1),
  5.  //               array('OfferListingId' => 'bbbbbbbbbb', 'Quantity' => 10),
  6.  //               array('ASIN' => 'cccccccccc', 'Quantity' => 20));
  7.  $result $amazon->CartAdd('[Cart ID]''[HMAC]'$item);
  8.  ?>


Parameters:

string   $cart_id   —  A unique identifier for a cart
string   $hmac   —  A unique security token
array   $item   —  Products and the quantities
array   $options   —  The optional parameters

[ Top ]

CartClear   [line 545]

array CartClear( string $cart_id, string $hmac, [array $options = array()])

Removes all the contents of a remote shopping cart

Parameters:

string   $cart_id   —  A unique identifier for a cart
string   $hmac   —  A unique security token
array   $options   —  The optional parameters

[ Top ]

CartCreate   [line 574]

array CartCreate( array $item, [array $options = array()])

Creates a new remote shopping cart

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $item = array('ASIN' => 'aaaaaaaaaa''Quantity' => 1);
  4.  // $item = array(array('ASIN' => 'aaaaaaaaaa', 'Quantity' => 1),
  5.  //               array('ASIN' => 'cccccccccc', 'Quantity' => 20));
  6.  $result $amazon->CartCreate($item);
  7.  ?>


Parameters:

array   $item   —  Products and the quantities
array   $options   —  The optional parameters

[ Top ]

CartGet   [line 592]

array CartGet( string $cart_id, string $hmac, [array $options = array()])

Retrieves the contents of a remote shopping cart

Parameters:

string   $cart_id   —  A unique identifier for a cart
string   $hmac   —  A unique security token
array   $options   —  The optional parameters

[ Top ]

CartModify   [line 624]

array CartModify( string $cart_id, string $hmac, array $item, [array $options = array()])

Modifies the quantity of items in a cart and changes cart items to saved items

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $item = array('CartItemId' => 'aaaaaaaaaa''Quantity' => 1);
  4.  // $item = array('CartItemId' => 'aaaaaaaaaa', 'Action' => 'SaveForLater');
  5.  // $item = array(array('CartItemId' => 'aaaaaaaaaa', 'Quantity' => 1),
  6.  //               array('CartItemId' => 'cccccccccc', 'Quantity' => 20));
  7.  $result $amazon->CartModify('[Cart ID]''[HMAC]'$item);
  8.  ?>


Parameters:

string   $cart_id   —  A unique identifier for a cart
string   $hmac   —  A unique security token
array   $item   —  The CartItemId and the quantities or the Action
array   $options   —  The optional parameters

[ Top ]

CustomerContentLookup   [line 643]

array CustomerContentLookup( string $customer_id, [array $options = array()])

Retrieves publicly available content written by specific Amazon customers

Parameters:

string   $customer_id   —  A customer ID
array   $options   —  The optional parameters

[ Top ]

CustomerContentSearch   [line 660]

array CustomerContentSearch( [array $customer = null], [array $options = array()])

Searches for Amazon customers by name or email address

Parameters:

array   $customer   —  A customer's name or its email
array   $options   —  The optional parameters

[ Top ]

doBatch   [line 918]

array doBatch( string $operation, array $shared, [array $params1 = array()], [array $params2 = array()])

Combines requests for the same operation into a single request

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $shared = array('SearchIndex' => 'Books',
  4.                  'Keywords' => 'php');
  5.  $params1 = array('ItemPage' => '1');
  6.  $params2 = array('ItemPage' => '2');
  7.  $result $amazon->doBatch('ItemSearch'$shared$params1$params2);
  8.  ?>

  • Return: The array of information returned by the query
  • Access: public

Parameters:

string   $operation   —  The operation
array   $shared   —  Shared parameters
array   $params1   —  The parameters specific to the first request
array   $params2   —  The parameters specific to the second request

[ Top ]

doMultiOperation   [line 956]

array doMultiOperation( string $operation1, array $params1, string $operation2, array $params2)

Combines the different operations into a single request

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $params1 = array('SearchIndex' => 'Books',
  4.                   'Title' => 'sushi');
  5.  $params2 = array('Keywords' => 'tempura');
  6.  $result $amazon->doMultiOperation('ItemSearch'$params1,
  7.                                      'SellerListingSearch'$params2);
  8.  ?>

  • Return: The array of information returned by the query
  • Access: public

Parameters:

string   $operation1   —  The first operation
array   $params1   —  The parameters specific to the first request
string   $operation2   —  The second operation
array   $params2   —  The parameters specific to the second request

[ Top ]

getApiVersion   [line 241]

string getApiVersion( )

Retrieves the current version of this classes API
  • Return: The API version
  • Access: public

[ Top ]

getError   [line 440]

array getError( )

Retrieves the error code and message

  1.  if (PEAR::isError($result)) {
  2.      $error $amazon->getError();
  3.      echo $error['Code'];
  4.      echo $error['Message'];
  5.  }

  • Return: All errors
  • Access: public

[ Top ]

getErrors   [line 421]

array getErrors( )

Retrieves all error codes and messages

  1.  if (PEAR::isError($result)) {
  2.      foreach ($amazon->getErrors(as $error{
  3.          echo $error['Code'];
  4.          echo $error['Message'];
  5.      }
  6.  }

  • Return: All errors
  • Access: public

[ Top ]

getLastUrl   [line 462]

string getLastUrl( )

Retrieves the last URL accessed to the Amazon (for debugging)
  • Return: The Last URL
  • Access: public

[ Top ]

getProcessingTime   [line 451]

string getProcessingTime( )

Retrieves the processing time
  • Return: Processing time
  • Access: public

[ Top ]

getRawResult   [line 473]

string getRawResult( )

Retrieves the raw result
  • Return: The raw result
  • Access: public

[ Top ]

Help   [line 685]

array Help( string $help_type, string $about, [array $options = array()])

Retrieves information about operations and response groups

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $result $amazon->Help('Operation''ItemLookup');
  4.  ?>

  • Return: The array of information returned by the query
  • Access: public

Parameters:

string   $help_type   —  The type of information
string   $about   —  The name of an operation or a response group
array   $options   —  The optional parameters

[ Top ]

ItemLookup   [line 713]

array ItemLookup( string $item_id, [array $options = array()])

Retrieves information for products

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $options = array();
  4.  $options['ResponseGroup''Large';
  5.  $result $amazon->ItemLookup('[ASIN(s)]'$options);
  6.  ?>


Parameters:

string   $item_id   —  Product IDs
array   $options   —  The optional parameters

[ Top ]

ItemSearch   [line 745]

array ItemSearch( string $search_index, [array $options = array()])

Searches for products

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $options = array();
  4.  $options['Keywords''sushi';
  5.  $options['Sort''salesrank';
  6.  $options['ResponseGroup''ItemIds,ItemAttributes,Images';
  7.  $result $amazon->ItemSearch('Books'$options);
  8.  ?>


Parameters:

string   $search_index   —  A search index
array   $options   —  The optional parameters

[ Top ]

ListLookup   [line 763]

array ListLookup( string $list_type, string $list_id, [array $options = array()])

Retrieves products in a specific list

Parameters:

string   $list_type   —  The type of list
string   $list_id   —  A list ID
array   $options   —  The optional parameters

[ Top ]

ListSearch   [line 791]

array ListSearch( string $list_type, array $keywords, [array $options = array()])

Searches for a wish list, baby registry, or wedding registry

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $keywords = array('Name' => 'hoge');
  4.  $result $amazon->ListSearch('WishList'$keywords);
  5.  ?>


Parameters:

string   $list_type   —  The type of list
array   $keywords   —  Parameters to search for
array   $options   —  The optional parameters

[ Top ]

SellerListingLookup   [line 810]

array SellerListingLookup( string $id_type, string $id, [array $options = array()])

Retrieves information about Amazon zShops and Marketplace products

Parameters:

string   $id_type   —  The type of ID
string   $id   —  The exchange ID or the listing ID
array   $options   —  The optional parameters

[ Top ]

SellerListingSearch   [line 837]

array SellerListingSearch( string $search_index, [array $options = array()])

Searches for Amazon zShops and Marketplace products

Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $keywords = array('Keywords' => 'pizza');
  4.  $result $amazon->SellerListingSearch('zShops'$keywords);
  5.  ?>


Parameters:

string   $search_index   —  The type of seller listings
array   $options   —  The optional parameters

[ Top ]

SellerLookup   [line 853]

array SellerLookup( string $seller_id, [array $options = array()])

Retrieves information about specific sellers
  • Return: The array of information returned by the query
  • Access: public

Parameters:

string   $seller_id   —  IDs for Amazon sellers
array   $options   —  The optional parameters

[ Top ]

setAccessKeyID   [line 253]

void setAccessKeyID( $keyid, string $subid)

Sets an Access Key ID
  • Access: public

Parameters:

string   $subid   —  An Access Key ID
   $keyid   — 

[ Top ]

setAssociateID   [line 277]

void setAssociateID( string $associd)

Sets an Associate ID
  • Access: public

Parameters:

string   $associd   —  An Associate ID

[ Top ]

setBaseUrl   [line 289]

void setBaseUrl( string $url)

Sets the base URL
  • Access: public

Parameters:

string   $url   —  The base url

[ Top ]

setCache   [line 353]

mixed setCache( [string $container = 'file'], [array $container_options = array()])

Enables caching the data

Requires Cache to be installed. Example:

  1.  <?php
  2.  $amazon = new Services_AmazonECS4('[your Access Key ID here]');
  3.  $amazon->setCache('file'array('cache_dir' => 'cache/'));
  4.  $amazon->setCacheExpire(86400)// 86400 seconds = 24 hours
  5.  $result $amazon->BrowseNodeLookup('283155');
  6.  ?>


Parameters:

string   $container   —  Name of container class
array   $container_options   —  Array with container class options

[ Top ]

setCacheExpire   [line 384]

void setCacheExpire( integer $secs)

Sets cache expire time

Amazon dictates that any prices that are displayed that may be over an hour old should be accompanied by some sort of timestamp. You can get around that by expiring any queries that use the time in an hour (3600 seconds).


Parameters:

integer   $secs   —  Expire time in seconds

[ Top ]

setLocale   [line 303]

mixed setLocale( string $locale)

Sets the locale passed when making a query to Amazon

Currently US, UK, DE, JP, FR, and CA are supported

  • Return: A PEAR_Error on error, a true on success
  • Access: public

Parameters:

string   $locale   —  The new locale to use

[ Top ]

setProxy   [line 398]

void setProxy( string $host, [int $port = 8080], [string $user = null], [string $pass = null])

Sets a proxy
  • Access: public

Parameters:

string   $host   —  Proxy host
int   $port   —  Proxy port
string   $user   —  Proxy username
string   $pass   —  Proxy password

[ Top ]

setSubscriptionID   [line 265]

void setSubscriptionID( string $subid)

Sets a Subscription ID (for backward compatibility)
  • Access: public

Parameters:

string   $subid   —  A Subscription ID

[ Top ]

setVersion   [line 328]

void setVersion( string $version)

Sets a version
  • Access: public

Parameters:

string   $version   —  A service version

[ Top ]

SimilarityLookup   [line 869]

array SimilarityLookup( string $item_id, [array $options = array()])

Retrieves products that are similar to Amazon products
  • Return: The array of information returned by the query
  • Access: public

Parameters:

string   $item_id   —  Product IDs
array   $options   —  The optional parameters

[ Top ]

TransactionLookup   [line 888]

array TransactionLookup( string $transaction_id, [array $options = array()])

Retrieves information about the status of financial transactions
  • Return: The array of information returned by the query
  • Access: public

Parameters:

string   $transaction_id   —  Transaction IDs
array   $options   —  The optional parameters

[ Top ]


Documentation generated on Thu, 10 Dec 2015 05:48:05 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.