Skip to content

Instantly share code, notes, and snippets.

@hiraq
Created March 23, 2012 15:16
Show Gist options
  • Save hiraq/2171638 to your computer and use it in GitHub Desktop.
Save hiraq/2171638 to your computer and use it in GitHub Desktop.
How to use php-amazon-pa-wrapper
<?php
define('ROOT',dirname(__FILE__));
define('DS',DIRECTORY_SEPARATOR);
ini_set('display_errors','On');
error_reporting(-1);
function debug($var) {
echo '<pre>';
print_r($var);
echo '</pre>';
}
set_include_path(get_include_path().PATH_SEPARATOR.ROOT.DS.'php-amazon-pa-wrapper');
require_once 'Amazon.php';
use AmazonProductAdvertising\Amazon as Amazon;
use AmazonProductAdvertising\Amazon\Exception as Amazon_Exception;
//set autoload lib
Amazon::set_autoload();
/*
* check hash_hmac compatibility
*/
if( Amazon::checkCompatHash() ) {
try{
/*
* set amazon accounts
*/
$amazon = Amazon::getInstance();
$amazon->setAccountIds('your_aws_key','your_secret_key','your_tag_key');
/*
* set operations
*/
$amazon->request()->detail('0596157134');
$amazon->request()->setParams(array(
'ResponseGroup' => 'Large'
));
$amazon->response()->proceed($amazon->request()->send());
debug($amazon->response()->getItems());
}catch(Amazon_Exception $e){
echo $e->getMessage();
}
}
@sanjusethi2004
Copy link

how to use this can you explain..i am new to php..my requirement is to get amazon product imported to my wordpress website

@mjsorribas
Copy link

What is your_tag_key?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment