saikaze
9/8/2016 - 7:44 AM

example.php

<?php

require_once "vendor/autoload.php";

// First send any feed, it may contain wrong content, that's not what you need to check here
print_r(sendInventoryFeed('test'));

// Then get feed result
//print_r(getFeedResult('feedIt')); 

function sendInventoryFeed($feed) {
    try {
        $amz=new AmazonFeed(); //if there is only one store in config, it can be omitted
        $amz->setFeedType("_POST_PRODUCT_DATA_"); //feed types listed in documentation
        $amz->setFeedContent($feed); //can be either XML or CSV data; a file upload method is available as well
        $amz->submitFeed(); //this is what actually sends the request
        return $amz->getResponse();
    } catch (Exception $ex) {
        echo 'There was a problem with the Amazon library. Error: '.$ex->getMessage();
    }
}


function getFeedResult($feedId) {
    try {
        $amz=new AmazonFeedResult("YourAmazonStore", $feedId); //feed ID can be quickly set by passing it to the constructor
        $amz->setFeedId($feedId); //otherwise, it must be set this way
        $amz->fetchFeedResult();
        return $amz->getRawFeed();
    } catch (Exception $ex) {
        echo 'There was a problem with the Amazon library. Error: '.$ex->getMessage();
    }
}