Created
March 23, 2012 15:16
-
-
Save hiraq/2171638 to your computer and use it in GitHub Desktop.
How to use php-amazon-pa-wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use this can you explain..i am new to php..my requirement is to get amazon product imported to my wordpress website