In this Example you will learn how to setup & configure the Amazon Product api PHP interface library.
- Require the AmazonProductAPI main class
require_once( dirname(__FILE__) . '/AmazonProductAPI.php' );
*Please note that the path may very depending on where your script is in comparison to the Library.
- Register the Auto Loader
spl_autoload_register(array('AmazonProductAPI', 'autoload') );
By using the Auto Loader we ensure that classes are loaded only if they are needed.
- Set Amazon Account information
$api = new AmazonProductAPI(); $api->setAccessKey( "public-key" ); $api->setSecretKey( "secret-key" );
*To utilize the Amazon Product API you will need to have a Amazon Web Service account. This account is free and once created will provide you with the credentials needed to use the API. To create your account visit the Amazon Web Service website.
Where to go from here
- How to do a Product Search – An introductory tutorial walking you through the request options and the returned AmazonProduct_Result object.