Fix amazon lookup.

This commit is contained in:
DariusIII
2016-12-05 12:50:17 +01:00
parent 7de79fff40
commit a48159e97d
3 changed files with 19 additions and 4 deletions
+5 -2
View File
@@ -4,7 +4,6 @@ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR .
use ApaiIO\ApaiIO;
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Search;
use ApaiIO\ResponseTransformer\XmlToSimpleXmlObject;
use app\models\Settings;
@@ -13,12 +12,16 @@ $privkey = Settings::value('APIs..amazonprivkey');
$asstag = Settings::value('APIs..amazonassociatetag');
$conf = new GenericConfiguration();
$client = new \GuzzleHttp\Client();
$request = new \ApaiIO\Request\GuzzleRequest($client);
$conf
->setCountry('com')
->setAccessKey($pubkey)
->setSecretKey($privkey)
->setAssociateTag($asstag)
->setResponseTransformer(XmlToSimpleXmlObject::class);
->setRequest($request)
->setResponseTransformer(new \ApaiIO\ResponseTransformer\XmlToSimpleXmlObject());
$search = new Search();
$search->setCategory('VideoGames');
+7 -1
View File
@@ -1,8 +1,10 @@
<?php
namespace nntmux;
use ApaiIO\Request\GuzzleRequest;
use ApaiIO\ResponseTransformer\XmlToSimpleXmlObject;
use app\models\Settings;
use GuzzleHttp\Client;
use nntmux\db\DB;
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Search;
@@ -338,13 +340,17 @@ class Books
public function fetchAmazonProperties($title)
{
$conf = new GenericConfiguration();
$client = new Client();
$request = new GuzzleRequest($client);
try {
$conf
->setCountry('com')
->setAccessKey($this->pubkey)
->setSecretKey($this->privkey)
->setAssociateTag($this->asstag)
->setResponseTransformer(XmlToSimpleXmlObject::class);
->setRequest($request)
->setResponseTransformer(new XmlToSimpleXmlObject());
} catch (\Exception $e) {
echo $e->getMessage();
}
+7 -1
View File
@@ -1,8 +1,10 @@
<?php
namespace nntmux;
use ApaiIO\Request\GuzzleRequest;
use ApaiIO\ResponseTransformer\XmlToSimpleXmlObject;
use app\models\Settings;
use GuzzleHttp\Client;
use nntmux\db\DB;
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Search;
@@ -713,13 +715,17 @@ class Console
public function fetchAmazonProperties($title, $node)
{
$conf = new GenericConfiguration();
$client = new Client();
$request = new GuzzleRequest($client);
try {
$conf
->setCountry('com')
->setAccessKey($this->pubkey)
->setSecretKey($this->privkey)
->setAssociateTag($this->asstag)
->setResponseTransformer(XmlToSimpleXmlObject::class);
->setRequest($request)
->setResponseTransformer(new XmlToSimpleXmlObject());
} catch (\Exception $e) {
echo $e->getMessage();
}