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

Class: Services_AmazonECS4

Source Location: /Services_Amazon-0.9.0/Services/AmazonECS4.php

Class Overview


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


Author(s):

Version:

  • Release: 0.9.0

Methods


Inherited Variables

Inherited Methods


Class Details

[line 108]
Class for accessing and retrieving information from Amazon's Web Services


[ Top ]


Method Detail

Services_AmazonECS4 (Constructor)   [line 235]

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 501]

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 532]

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 552]

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 581]

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 599]

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 631]

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 650]

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 667]

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 925]

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 963]

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 248]

string getApiVersion( )

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

[ Top ]

getError   [line 447]

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 428]

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 469]

string getLastUrl( )

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

[ Top ]

getProcessingTime   [line 458]

string getProcessingTime( )

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

[ Top ]

getRawResult   [line 480]

string getRawResult( )

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

[ Top ]

Help   [line 692]

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 720]

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 752]

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 770]

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 798]

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 817]

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 844]

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 860]

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 260]

void setAccessKeyID( $keyid, string $subid)

Sets an Access Key ID
  • Access: public

Parameters:

string   $subid     An Access Key ID
   $keyid     

[ Top ]

setAssociateID   [line 284]

void setAssociateID( string $associd)

Sets an Associate ID
  • Access: public

Parameters:

string   $associd     An Associate ID

[ Top ]

setBaseUrl   [line 296]

void setBaseUrl( string $url)

Sets the base URL
  • Access: public

Parameters:

string   $url     The base url

[ Top ]

setCache   [line 360]

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 391]

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 310]

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 405]

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 272]

void setSubscriptionID( string $subid)

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

Parameters:

string   $subid     A Subscription ID

[ Top ]

setVersion   [line 335]

void setVersion( string $version)

Sets a version
  • Access: public

Parameters:

string   $version     A service version

[ Top ]

SimilarityLookup   [line 876]

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 895]

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, 22 Dec 2011 13:00:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.