/** * Returns a new request for the given connection and operation. * * @param string $operation An operation from Operations. * @param array $data [optional] Extra data to send. */ public function __construct($operation, $data = null) { $this->connection = AmazonSDK::getDefaultConnection(); $this->operation = $operation; $this->data = $data; }
*/ include 'autoload.php'; /* * Declare the classes you are using, they'll be automatically included. */ use Amazon\AmazonSDK; use Amazon\Connection; use Amazon\Entities\Account; use Amazon\Entities\Worker; /* * Set up the connection and set it for the SDK to use as the default one. * You can change the default Connection in the middle of your script, too. * Each request will use the default Connection it finds at that exact moment. */ $connection = new Connection('ACCESS_KEY', 'PRIVATE_KEY', true); AmazonSDK::setDefaultConnection($connection); /* * Get the available balance in your Account, as a Price entity. */ $account = new Account(); try { $balance = $account->getBalance(); } catch (RequestException $re) { // There was a request-level error! } catch (OperationResultException $oe) { // There was an operation-level error! } print_r($balance->toArray()); /* * Working with Workers! * You can instantiate a new Worker from a given Id.