exeu / apai-io Goto Github PK
View Code? Open in Web Editor NEWDISCONTINUED Amazon Product Adverstising Library based on PHP REST and SOAP (only V1) using the Product Advertising API.
Home Page: http://apai-io.readthedocs.io/en/latest/
DISCONTINUED Amazon Product Adverstising Library based on PHP REST and SOAP (only V1) using the Product Advertising API.
Home Page: http://apai-io.readthedocs.io/en/latest/
Thanks for this API.
I see that "IN" is missed in the list of supported domains at http://exeu.github.io/apai-io/basic-usage.html
But in the code, its present.
One way I deal with the Search Index values is by just creating a simple constants container object. This is helpful for purposes of being expressive while also being "code completion" friendly in my IDE ( which is more productive for me at least ). I'm sure there are number of other ways to do this same thing ( global constants, enums, whatever )
A list like this would also add the convenience of not needing go through the documentation to check if SearchIndex values changed ( with new/removed items just being documented in the release notes ).
Anyways, here is an example ( SearchIndex, in this case, only represents US indexes - since those are all that I need. ):
<?php
namespace MyApp;
class SearchIndex {
const ALL = 'All';
const APPLIANCES = 'Appliances';
const ARTS_AND_CRAFTS = 'ArtsAndCrafts';
const AUTOMOTIVE = 'Automotive';
const BABY = 'Baby';
const BEAUTY = 'Beauty';
const BLENDED = 'Blended';
const BOOKS = 'Books';
const CLASSICAL = 'Classical';
const COLLECTIBLES = 'Collectibles';
const DIGITAL_MUSIC = 'DigitalMusic';
const DVD = 'DVD';
const ELECTRONICS = 'Electronics';
const GOURMET_FOOD = 'GourmetFood';
const GROCERY = 'Grocery';
const HEALTH_PERSONAL_CARE = 'HealthPersonalCare';
const HOME_GARDEN = 'HomeGarden';
const INDUSTRIAL = 'Industrial';
const JEWELRY = 'Jewelry';
const KINDLE_STORE = 'KindleStore';
const KITCHEN = 'Kitchen';
const LAWN_GARDEN = 'LawnAndGarden';
const MAGAZINES = 'Magazines';
const MARKETPLACE = 'Marketplace';
const MISCELLANEOUS = 'Miscellaneous';
const MOBILE_APPS = 'MobileApps';
const MP3_DOWNLOADS = 'Mp3Downloads';
const MUSIC = 'Music';
const MUSICAL_INSTRUMENTS = 'MusicalInstruments';
const MUSIC_TRACKS = 'MusicTracks';
const OFFICE_PRODUCTS = 'OfficeProducts';
const OUTDOOR_LIVING = 'OutdoorLiving';
const PC_HARDWARE = 'PCHardware';
const PET_SUPPLIES = 'PetSupplies';
const PHOTO = 'Photo';
const SHOES = 'Shoes';
const SOFTWARE = 'Software';
const SPORTING_GOODS = 'SportingGoods';
const TOOLS = 'Tools';
const TOYS = 'Toys';
const VIDEO = 'Video';
const VIDEO_GAMES = 'VideoGames';
const WATCHES = 'Watches';
const WIRELESS = 'Wireless';
const WIRELESS_ACCESSORIES = 'WirelessAccessories';
}
Usage is then pretty easy:
<?php
// ....
uses MyApp\SearchIndex as SearchIndex;
echo SearchIndex::SOFTWARE;
?>
Supporting multiple countries would be easy enough ( SearchIndex contains the constants accessible by everyone, ALL, BOOKS, ELECTRONICS
, with subclasses (like US) supplying the missing ones ( like APPAREL, GOURMET_FOOD, etc. ).
<?php
namespace ApaiIO\SearchIndex;
class US extends SearchIndex {
const APPAREL = 'Apparel';
// etc...
}
Still simple to use:
<?php
//...
uses ApaiIO\SearchIndex\US as SearchIndex;
echo SearchIndex::ALL;
echo SearchIndex::APPAREL;
?>
I could then just do any number of things with this, like create my own SearchIndex by country for a specific topic, like Tech.
<?php
// ...
namespace MyApp\SearchIndex;
uses ApaiIO\SearchIndex\US as Idx;
class Tech {
public static $searchIndexes = array( Idx::BOOKS, Idx::MOBILE_APPS, Idx::PC_HARDWARE, Idx::SOFTWARE );
}
Anyways - thought i'd throw it out there... Could expand on this with categories and others if ya wanted to too 🤘
Looks like I can only go through 10 pages. Is it possible to get say 10 items from the 15th page?
I've gotten your sample code to work without installing your library in your recommended fashion. I just included all the libary files, in required order, in my PHP code, and I commented out the require_once of bootstrap.php. This avoided dealing with shared server management to get them to install the way you recommend.
What advantages would I have if I get it installed the way you recommend instead? And, what disadvantages do I have doing it the way I have?
I am new to web development.
Any suggestions on how to integrate this library into Wordpress? I have installed the package via Composer, but would love a bit of explanation (or a tutorial!) on where to place the "configuration" and "operation" code mentioned here: http://exeu.github.io/apai-io/basic-usage.html.
Would this go within the Wordpress functions.php file? Can I place it somewhere else to allow for easy upgrades of my theme's functions.php file (I'm using this excellent Wordpress + zurb foundation theme: https://github.com/olefredrik/FoundationPress).
Finally, can anyone recommend basic tutorials on how to use web services like apai-io within wordpress?
THANKS!
To anyone who can help:
I have one issue in two parts.
Part I.
Will someone help me determine how I can I get a list of items (... the first 10 results would be fine ...) from a node when I provide the node number? The short story is that Amazon does not provide RSS feeds for some of its nodes ... for example node 3445246011. However, even though there is not an RSS feed for this node, there are still products available. http://www.amazon.com/l/3445246011
use ApaiIO\ApaiIO;
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Search;
$conf = new GenericConfiguration();
try {
$conf
->setCountry('com')
->setAccessKey('***')
->setSecretKey('***')
->setRequest('\ApaiIO\Request\Rest\Request')
->setAssociateTag('***');
} catch (\Exception $e) {
echo $e->getMessage();
}
$apaiIO = new ApaiIO($conf);
$search = new Search();
$search->setBrowseNode(3445246011);
$search->setResponseGroup(array('Medium'));
$response = $apaiIO->runOperation($search);
$response = json_decode (json_encode (simplexml_load_string ($response)), true);
echo '<pre>';
print_r ($response);
echo '</pre>';
Part II.
In a perfect world, I would have apai-io create a properly formatted request and then I would use another piece of software -- Zebra_cURL -- to grab the properly formatted feed and cache the response from that feed locally. In this manner, I would avoid hammering the Amazon API. However, I don't think it's possible to view the properly formatted feed that apai-io creates -- or is it?
Thanks!
$response = $apaiIo->runOperation($search) returns a long string depending on the response group chosen. It is impossible for me to convert it to the XML form described in amazon documentation. Is there something that I forgot or do I need to parse this string ?
Thank you for this incredible work !
Offline all working fine, but online I get this error:
[message:protected] => An error occurred while setting 52 with value 1
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /ApaiIO/exeu/apai-io/lib/ApaiIO/Request/Rest/Request.php
[line:protected] => 143
What this error means? I use online centOS 6.5 (Final) with PHP 5.5.6
yum install php-curl
Package php-common-5.4.27-33.el6.art.x86_64 already installed and latest version
Request.php:
foreach ($options as $currentOption => $currentOptionValue) {
if (false === @curl_setopt($ch, $currentOption, $currentOptionValue)) {
throw new \RuntimeException(
sprintf(
"An error occurred while setting %s with value %s",
$currentOption,
$currentOptionValue
)
);
}
}
Hey!
My app was working very good for some days but yesterday my app throwed the following error:
Fatal error: Uncaught SoapFault exception: [aws:Client.RequestThrottled] Request from A1PAQS5FGRGV1 is throttled.
I updated my obsolete ApaIO class with the new commit from github but error still appears.
What is happening?
Regards!
I see the demo only has a limit number of countries. I need to use the API for Indian market, does the SDK support it?
Thanks
I guess the library don't support amazon.in right now. So, please add support for recently launched Amazon India. Thanks!
Hi I have a client, that I implemented this for, that used shared hosting, when using this library I am getting the following errors:
Fatal error: Uncaught exception 'RuntimeException' with message 'An error occurred while setting 52 with value 1' in {omitted}/vendor/exeu/apai-io/lib/ApaiIO/Request/Rest/Request.php:143
i took a look at that file and the following code is there:
foreach ($options as $currentOption => $currentOptionValue) {
if (false === @curl_setopt($ch, $currentOption, $currentOptionValue)) {
throw new \RuntimeException(
sprintf(
"An error occurred while setting %s with value %s",
$currentOption,
$currentOptionValue
)
);
}
}
after removing the @ and running again i see the following error:
Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in {omitted}/vendor/exeu/apai-io/lib/ApaiIO/Request/Rest/Request.php on line 142
would there be a way to get round this?
Hello,
I have above 1000 amazon items and want update all prices daily, Is this with one or few requests possible or I must request each ASIN one by one?
Maximum items per request is ten asin: http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemLookup.html
Its only allowed one request per second: http://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html
The unit tests should be moved in a separate namespace.
With this change the folder structure has to be changed to match the rules of psr-0
Hello. First of all, thank you for the great library.
I was successfully returning products for almost 6 months with no issues. Without changing any line of code, the PHP code stop working few days ago, see error message. Before the error message, I am putting pieces of my code. Thank you in advance.
->setResponseTransformer('\ApaiIO\ResponseTransformer\ObjectToArray')
->setRequest('\ApaiIO\Request\Soap\Request')
->setCountry('com')
$browseNodeLookup = new BrowseNodeLookup();
$browseNodeLookup->setNodeId('2619526011'); /*node number */
$browseNodeLookup->setResponseGroup(array('TopSellers', 'MostWishedFor'));
$formattedResponse = $apaiIO->runOperation($browseNodeLookup);
if (array_key_exists("TopItemSet", $formattedResponse["BrowseNodes"]["BrowseNode"]))
The error is happening exactly in the last line above. The error message is below.
Fatal error: Uncaught SoapFault exception: [aws:Server.InternalError] We encountered an internal error. Please try again. in /home/storage/e/3d/de/site157/public_html/backend/data_reader/lib/ApaiIO/Request/Soap/Request.php:152 Stack trace: #0 /home/storage/e/3d/de/site157/public_html/backend/data_reader/lib/ApaiIO/Request/Soap/Request.php(152): SoapClient->__soapCall('BrowseNodeLooku...', Array) #1 /home/storage/e/3d/de/site157/public_html/backend/data_reader/lib/ApaiIO/Request/Soap/Request.php(67): ApaiIO\Request\Soap\Request->performSoapRequest(Object(ApaiIO\Operations\BrowseNodeLookup), Array) #2 /home/storage/e/3d/de/site157/public_html/backend/data_reader/lib/ApaiIO/ApaiIO.php(73): ApaiIO\Request\Soap\Request->perform(Object(ApaiIO\Operations\BrowseNodeLookup)) #3 /home/storage/e/3d/de/site157/public_html/backend/data_reader/reader_part_1.php(65): ApaiIO\ApaiIO->runOperation(Object(ApaiIO\Operations\BrowseNodeLookup)) #4 {main} thrown in /home/storage/e/3d/de/site157/public_html/backend/data_reader/lib/ApaiIO/Request/Soap/Request.php on line 152
The Class ApaiIO\Request\Rest\Request class should use the curl extension for the request. The benefits are you have the posiblity to sett the timeout connection and to follow redirects.
The type hint here makes no sense, if we take a look in the ApaiIO\Request\RequestFactory::applyCallback method. The applyCallback method expects a callable argument and this is not only a closure. I would suggest to remove the type hint here and to validate the argument with the function is_callable. If the validation fails, we should throw a InvalidArgumentExeption. Since we support the php 5.3 version, we can't use the callable type hint. Rremove the type hint here and validate the argument with the function is_callable.
Using e.g. curl_multi()
it is possible to do HTTP requests in parallel. This technique would decrease the loading time in situations where more than one requests need to be done. This makes also a lot of sense when retrieving information from APIs.
Parallel requests could for example be used to obtain results from the german and the british catalog in parallel. This would be a really nice feature and add a noticable speed bump.
Please add a feature to this framework to enable submitting batch requests to the API.
I'm referring to what's documented in Amazon's Product Advertising API Developer Guide, starting page 71, Batch Requests (enabling 2 different requests to be sent simultaneously and responded to simultaneously).
It would enable REST requests, for example, to use
Operation.1.ParameterName=ParameterValue
Operation.2.ParameterName=ParameterValue
Operation.Shared.ParameterName=ParameterValue
This would enable, for example, getting 2 consecutive pages totaling 20 products, without waiting 1 second between requests. (I'd need it to work with SOAP requests, too.)
Any suggestion how to receive the shipping costs of a product? Can't get the values so far
FOUNDED
Hi guyz,
I have installed apai-io using composer in Laravel 5.
But when i try to run the below code. It give me error.
"Class 'ApaiIO\Configuration\GenericConfiguration' not found Error!"
AmazonAPI.php-
<?php
use ApaiIO\ApaiIO;
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Lookup;
$conf = new GenericConfiguration();
?>
I try execute example from documentation:
...
$search = new Search();
$search->setCategory('DVD');
$search->setActor('Bruce Willis');
$search->setKeywords('Die Hard');
...
And get this:
string(427) "<?xml version="1.0"?>
<ItemSearchErrorResponse xmlns="http://ecs.amazonaws.com/doc/2011-08-01/"><Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message></Error><RequestId>21fc60ae-c9f1-4b2a-a0a5-366750ac4e86</RequestId></ItemSearchErrorResponse>"
Would it be possible to implement some cache functionality?
Recommend to re-attempt to connect after a few seconds of delay when first attempt was not successful.
[11-Jan-2015 09:27:55 GMT] PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /home/***/public_html/__Apai-IO/vendor/exeu/apai-io/lib/ApaiIO/Request/Soap/Request.php:152
When i search some products here in demo http://apaiio.dev.pixel-web.org/ i get few results. But when i search in my app with same library i get many results. How can i limit the results?
it would be very helpful if you will put this http://apaiio.dev.pixel-web.org/ in git. Thanks
Hi Exeu,
I'm currently testing your library and it's working well, so - thanks.
But sometimes I receive the error "requests too quickly". I know this error comes from amazon but I have in mind, that there was somewere an option to slow this down by your lib. But I can't find it anymore.
Can you give me a hint?
Thanks and cheers,
Matthias
I keep getting:
<b>Fatal error</b>: Uncaught exception 'RuntimeException' with message 'An error occurred while sending request. Error number: 28; Error message: Operation timed out after 10000 milliseconds with 5583 bytes received' in /vendor/exeu/apai-io/lib/ApaiIO/Request/Rest/Request.php:172
Stack trace:
#0 /vendor/exeu/apai-io/lib/ApaiIO/ApaiIO.php(73): ApaiIO\Request\Rest\Request->perform(Object(ApaiIO\Operations\Search))
#1 amazon.php(81): ApaiIO\ApaiIO->runOperation(Object(ApaiIO\Operations\Search))
#2 amazon.php(58): searchItem('INTERMEC', 'Hand Strap for ...', 35.442, 'com')
#3 combined.php(103): getItem('INTERMEC', 'Hand Strap for ...', 35.442, 'com')
#4 {main}
thrown in <b>/vendor/exeu/apai-io/lib/ApaiIO/Request/Rest/Request.php</b> on line <b>172</b><br />
.. is there any way to rate limit the requests to 1 request / sec
which is the current limit.
Hello Exeu,
I'm trying to make products requests to ES region but I'm always getting Warning: file_get_contents(http://webservices.amazon.es/onca/xml error. With another regions all works.
Is not it possible to make requests to ES region?
Thank you in advance! Regards.
Hi,
since the last update I got an Exception raised from the Request class saying that it can't found the SoapClient.
FatalErrorException: Error: Class 'SoapClient' not found in
/var/www/html/vendor/exeu/apai-io/lib/ApaiIO/Request/Soap/Request.php line 136
Could you tell us what has changed ? Thanks
I guess this is not a native apai-io problem but so far I have not been able to use user access keys as they are recommended by amazon:
Delete your AWS root account access keys, because they provide unrestricted access to your AWS resources. Instead, use IAM user access keys or temporary security credentials.
If I use my root access keys everything is fine. If I use the user access keys I have created for my project, I get this message instead:
...AWS.InvalidAccount Your AccessKey Id is not registered for Product Advertising API. Please use the AccessKey Id obtained after registering at https://affiliate-program.amazon.com/gp/flex/advertising/api/sign-in.html.
My guess is that I need additional settings for groups/roles/policies for this particular user but I'm lost what exactly is expected my AWN.
If anybody could shed some light, I would be very happy.
Cheers,
pepebe
Hi,
have you planned on adding the sort option to the SearchOperation ? Maybe it's already there but I didn't find it.
I think you just have to add a method to the ApaiIO\Operations\Search :
public function setSort($sort)
{
$this->parameter['Sort'] = $sort;
return $this;
}
I'll try to make a pullrequest, but I've never done it before.
Source : http://docs.aws.amazon.com/AWSECommerceService/latest/DG/SortingbyPopularityPriceorCondition.html
Is there a way to use this framework to submit batch requests to the API?
I'm referring to what's documented in Amazon's Product Advertising API Developer Guide, starting page 71, Batch Requests (enabling 2 different requests to be sent simultaneously and responded to simultaneously).
It would enable REST requests, for example, to use
Operation.1.ParameterName=ParameterValue
Operation.2.ParameterName=ParameterValue
Operation.Shared.ParameterName=ParameterValue
This would enable getting 2 consecutive pages totaling 20 products, without waiting 1 second between requests. (I'd need it to work with SOAP requests, too.)
Hello. I dont think this is a bug in apai-io, but maybe? I request a ASIN for a "kindl" item but response have no "OfferSummary" data. Is this my mistake, from amazon or a problem with apai-io? All products working fine with apai-io exclude kindl items for amazon.DE.
I want the price of this item: http://www.amazon.de/exec/obidos/ASIN/B00J50S1IY/
$lookup = new Lookup();
$lookup->setItemId(implode(',',$items));
$lookup->setResponseGroup(array('Offers'));
$apaiIo = new ApaiIO($conf);
return $apaiIo->runOperation($lookup);
Result is:
<?xml version="1.0" ?><ItemLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01"><OperationRequest><HTTPHeaders><Header Name="UserAgent" Value="ApaiIO [2.0.0-DEV]"></Header></HTTPHeaders><RequestId>*********</RequestId><Arguments><Argument Name="Operation" Value="ItemLookup"></Argument><Argument Name="Service" Value="AWSECommerceService"></Argument><Argument Name="Signature" Value="******"></Argument><Argument Name="AssociateTag" Value="**********"></Argument><Argument Name="Version" Value="2011-08-01"></Argument><Argument Name="ItemId" Value="B00J50S1IY"></Argument><Argument Name="AWSAccessKeyId" Value="********"></Argument><Argument Name="Timestamp" Value="2015-02-08T20:33:04Z"></Argument><Argument Name="ResponseGroup" Value="Offers"></Argument></Arguments><RequestProcessingTime>0.0129570000000000</RequestProcessingTime></OperationRequest><Items><Request><IsValid>True</IsValid><ItemLookupRequest><IdType>ASIN</IdType><ItemId>B00J50S1IY</ItemId><ResponseGroup>Offers</ResponseGroup><VariationPage>All</VariationPage></ItemLookupRequest></Request><Item><ASIN>B00J50S1IY</ASIN></Item></Items></ItemLookupResponse>
Here a example from another item with working result:
<?xml version="1.0" ?><ItemLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01"><OperationRequest><HTTPHeaders><Header Name="UserAgent" Value="ApaiIO [2.0.0-DEV]"></Header></HTTPHeaders><RequestId>**********</RequestId><Arguments><Argument Name="Operation" Value="ItemLookup"></Argument><Argument Name="Service" Value="AWSECommerceService"></Argument><Argument Name="Signature" Value="**********"></Argument><Argument Name="AssociateTag" Value="**********"></Argument><Argument Name="Version" Value="2011-08-01"></Argument><Argument Name="ItemId" Value="B00PQ7E5VC"></Argument><Argument Name="AWSAccessKeyId" Value="**********"></Argument><Argument Name="Timestamp" Value="2015-02-08T20:41:53Z"></Argument><Argument Name="ResponseGroup" Value="Offers"></Argument></Arguments><RequestProcessingTime>0.0205450000000000</RequestProcessingTime></OperationRequest><Items><Request><IsValid>True</IsValid><ItemLookupRequest><IdType>ASIN</IdType><ItemId>B00PQ7E5VC</ItemId><ResponseGroup>Offers</ResponseGroup><VariationPage>All</VariationPage></ItemLookupRequest></Request><Item><ASIN>B00PQ7E5VC</ASIN><OfferSummary><LowestNewPrice><Amount>1299</Amount><CurrencyCode>EUR</CurrencyCode><FormattedPrice>EUR 12,99</FormattedPrice></LowestNewPrice><TotalNew>1</TotalNew><TotalUsed>0</TotalUsed><TotalCollectible>0</TotalCollectible><TotalRefurbished>0</TotalRefurbished></OfferSummary><Offers><TotalOffers>1</TotalOffers><TotalOfferPages>1</TotalOfferPages><MoreOffersUrl>**********</MoreOffersUrl><Offer><OfferAttributes><Condition>New</Condition></OfferAttributes><OfferListing><OfferListingId>**********</OfferListingId><Price><Amount>1299</Amount><CurrencyCode>EUR</CurrencyCode><FormattedPrice>EUR 12,99</FormattedPrice></Price><Availability>Noch nicht veröffentlicht</Availability><AvailabilityAttributes><AvailabilityType>now</AvailabilityType><IsPreorder>1</IsPreorder><MinimumHours>48</MinimumHours><MaximumHours>72</MaximumHours></AvailabilityAttributes><IsEligibleForSuperSaverShipping>1</IsEligibleForSuperSaverShipping></OfferListing></Offer></Offers></Item></Items></ItemLookupResponse>"
Can anybody help here, please? :)
you might want to do a version (tag) 1.8.0?
Perhaps I got the syntax wrong, but every ResponseTransformer returns "empty"
<?php
/**/
require_once "{omitted}/vendor/autoload.php";
use \ApaiIO\Configuration\GenericConfiguration;
use \ApaiIO\Operations\Search;
use \ApaiIO\ApaiIO;
use \ApaiIO\ResponseTransformer\ObjectToArray;
$ObjectToArray = new ObjectToArray();
$x = new \ApaiIO\Request\Rest\Request(
array(
\ApaiIO\Request\Rest\Request::FOLLOW_LOCATION => 0
)
);
$conf = new GenericConfiguration($x);
try
{
$conf
->setCountry('de')
->setAccessKey($modx->getOption('amazon.access.key.id'))
->setSecretKey($modx->getOption('amazon.secret.access.key'))
->setAssociateTag($modx->getOption('amazon.associate.tag'))
->setRequest($x);
if(isset($ObjectToArray)){
$conf->setResponseTransformer($ObjectToArray);
}
}
catch (\Exception $e)
{
return $e->getMessage();
}
$apaiIo = new ApaiIO($conf);
/* Start: Search */
$search = new Search();
$search->setCategory('Books');
$search->setAuthor('Steve Jackson');
$search->setKeywords('Fighting Fantasy');
$search->setCondition('Used');
/* End: Search */
$response = $apaiIo->runOperation($search);
var_dump($response);
// return $response;
Without ResponseTransformer I get a nice string:
string(18023) "...."
The string includes all the stuff I expect.
But if I want to use a Response Transformer (for example: ObjectToArray) I get this result:
array(0) { }
In my error log I find this message:
[2015-04-24 14:48:59](ERROR @ {omitted}/vendor/exeu/apai-io/lib/ApaiIO/ResponseTransformer/ObjectToArray.php : 45) PHP warning: Invalid argument supplied for foreach()
It seems foreach() inside buildArray($object) doesn't get a valid object.
Any idea whats going on here?
pepebe
No matter which Transformer I use, my output is always somthing like:
So there is %3D instead of an equal sign. Is there a way to fix it?
There are some unused use statements detected. Eliminate them.
With both CartCreate and CartAdd, if communicating with the API through SOAP, the item parameters don't get passed to the API.
Error Code is AWS.MissingParameters.
Error Message is "Your request is missing required parameters. Required parameters include Items."
If, on the other hand, we use REST, the item parameters get passed, and this error does not occur.
Receiving the data for one country (e.g. Amazon.de) will work with the following example. So far so good.
try {
$conf
->setCountry('de')
->setAccessKey(AWS_API_KEY)
->setSecretKey(AWS_API_SECRET_KEY)
->setAssociateTag(AWS_ASSOCIATE_TAG);
} catch (\Exception $e) {
echo $e->getMessage();
}
$apaiIO = new ApaiIO($conf);
$search = new Search();
$search->setCategory('DVD');
$search->setActor('Bruce Willis');
$search->setKeywords('Stirb Langsam');
$search->setPage(3);
$search->setResponseGroup(array('Large', 'Small'));
$formattedResponse = $apaiIO->runOperation($search);
echo $formattedResponse;
Is there a chance to get multiple country responses (e.g. for Amazon.com, Amazon.de & Amazon.es) within one api call? So in fact that I got the product links for each country store?
Request has expired. Timestamp date is 2014-08-26T23:46:43Z.
this msg appears to me
Hi,
Thanks for developing this library. I'm trying to search an item and although amazon search reveals results, but the API doesn't.
$search = new Search();
$search->setResponseGroup(array('ItemAttributes','ItemIds','Large'));
//$search->setCategory('All');
$search->setBrand('STARTECH');
$search->setKeywords('HDMI to VGA Adapter Converter 1920x1080');
$search->setCondition('New');
$search->setMinimumPrice('36.982');
.... there're no errors either so the query is correct. But as you can see here: http://www.amazon.com/s/ref=sr_nr_p_89_0?fst=as%3Aoff&rh=i%3Aaps%2Ck%3AHDMI+to+VGA+Adapter+Converter+1920x1080%2Cp_89%3AStarTech&keywords=HDMI+to+VGA+Adapter+Converter+1920x1080&ie=UTF8&qid=1424846004&rnid=2528832011 it should return results.
Setting category to all and remove brand shows results though. I tried the case sensitive brand name also, but still no results.
When ever I try to use the command
php composer.phar install I get this error
The requested package exeu/apai-io 1.0.0 could not be found.
This is my composer.json
{
"name": "exeu/apai-io",
"type": "library",
"description": "Amazon Product Advertising PHP Library",
"keywords": ["Amazon", "ECS", "Product Advertising", "SOAP", "REST", "Products"],
"homepage": "https://github.com/Exeu/apai-io",
"license": "Apache-2.0",
"authors": [
{
"name": "Jan Eichhorn",
"email": "[email protected]",
"role": "Maintainer"
},
{
"name": "Dejan Spasic",
"email": "[email protected]",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/Exeu/apai-io/issues"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"exeu/apai-io": "dev-master"
},
"autoload": {
"psr-0": { "ApaiIO": "lib/" }
}
Can you please tell my why it's not working when I have added the correct line you told me too?
}
All was working fine, but suddenly Error "SSL connection required for SOAP authentication" arises. Is this some thing wrong with Amazon API Servers or I am missing something in client configuration?
The search of products in the doc of amazon you can search for plenty of values:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html
I have modified the class to support BrowseNode and look into all the items of a category, just setting it in the Search class
/**
* Sets the amazon browseNode
*
* @param string $browseNode
*
* @return \ApaiIO\Operations\Search
*/
public function setBrowseNode($browseNode)
{
if (false === is_numeric($browseNode) || (int)$browseNode < 0) {
throw new \InvalidArgumentException(
sprintf(
'%s is an invalid browseNode value. It has to be numeric and positive',
$page
)
);
}
$this->parameter['BrowseNode'] = $browseNode;
return $this;
}
isn't a good idea to add all it? so far as it has setCondition and minimumPrice...
If it's ok I can make a pull request of the change.
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
Potential causes:
A typo in the package name
The package is not available in a stable-enough version according to your minimum-stability setting see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.
Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
my composer.json file content as follows:
{
"name": "exeu/apai-io",
"type": "library",
"description": "Amazon Product Advertising PHP Library",
"keywords": ["Amazon", "ECS", "Product Advertising", "SOAP", "REST", "Products"],
"homepage": "https://github.com/Exeu/apai-io",
"license": "Apache-2.0",
"authors": [
{
"name": "Jan Eichhorn",
"email": "[email protected]",
"role": "Maintainer"
},
{
"name": "Dejan Spasic",
"email": "[email protected]",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/Exeu/apai-io/issues"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0",
"ext-curl": "*"
},
"require": {
"exeu/apai-io": "dev-master"
},
"autoload": {
"psr-0": { "ApaiIO": "lib/" }
}
}
Why didn't this framework include what's needed to accomplish directly the CartGet and CartModify operations?
For example, is one faster than the other?
Thanks!
Is it possible to install and use this library without composer? In fact I want to integrate this into a plugin and the old fashion way with an include/require would be best in my opinion.
Thought about something like:
require_once "lib/ApaiIO/ApaiIO.php";
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\ApaiIO;
$conf = new GenericConfiguration();
$conf
->setCountry('com')
->setAccessKey('YOUR ACCESS KEY')
->setSecretKey('YOUR SECRET KEY')
->setAssociateTag('YOUR ASSOCIATE TAG');
$apaiIo = new ApaiIO($conf);
Does anyone have any ideas/suggestions on how to retrieve the product property filters? I'd like to have similar filters as Amazon has in their sidebar: http://www.amazon.com/s/ref=s9_acss_bw_ct_refTest_ct1_a1?ie=UTF8&page=1&rh=n:172659,p_n_feature_keywords_three_browse-bin:7688788011,n:!493964,n:1266092011,n:172282&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=merchandised-search-2&pf_rd_r=1MBJXCS6SY99SM7HMSX9&pf_rd_t=101&pf_rd_p=2090524742&pf_rd_i=172659
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.