Files
newznab-tmux/misc/testing/Tests/test_amazon_API.php
T
2016-03-08 10:44:02 +01:00

33 lines
867 B
PHP

<?php
require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Search;
use ApaiIO\ApaiIO;
use newznab\db\Settings;
$s = new Settings();
$pubkey = $s->getSetting('amazonpubkey');
$privkey = $s->getSetting('amazonprivkey');
$asstag = $s->getSetting('amazonassociatetag');
$conf = new GenericConfiguration();
$conf
->setCountry('com')
->setAccessKey($pubkey)
->setSecretKey($privkey)
->setAssociateTag($asstag)
->setResponseTransformer('\ApaiIO\ResponseTransformer\XmlToSimpleXmlObject');
$search = new Search();
$search->setCategory('VideoGames');
$search->setKeywords('Guilty Gear 2 Oveture');
$search->setResponseGroup(['Large']);
$search->setPage(1);
$apaiIo = new ApaiIO($conf);
$response = $apaiIo->runOperation($search);
var_dump($response);