如何使用亚马逊MWS API通过卖家ID在亚马逊中获取产品

时间:2015-05-21 08:37:19

标签: php amazon-web-services

我正在使用亚马逊MWS API创建我自己的网站,该网站将从亚马逊导入我的产品。 但我不知道如何使用我的卖家ID在亚马逊上取得我的产品..

require_once('config.inc.php');


$serviceUrl = "https://mws.amazonservices.com/Products/2011-10-01"; 

$config = array (
'ServiceURL' => $serviceUrl,
'ProxyHost' => null,
'ProxyPort' => -1,
'ProxyUsername' => null,
'ProxyPassword' => null,
'MaxErrorRetry' => 3,
);


$service = new MarketplaceWebServiceProducts_Client(
    AWS_ACCESS_KEY_ID,
    AWS_SECRET_ACCESS_KEY,
    APPLICATION_NAME,
    APPLICATION_VERSION,
    $config);


$request = newMarketplaceWebServiceProducts_Model_ListMatchingProductsRequest();
 $request->setSellerId(A1234V999SASDF);

invokeListMatchingProducts($service, $request);


    functioninvokeListMatchingProducts(MarketplaceWebServiceProducts_Interface $service, $request)
 {
  try {
    $response = $service->ListMatchingProducts($request);

    echo ("Service Response\n");
    echo  ("=============================================================================\n");

    $dom = new DOMDocument();
    $dom->loadXML($response->toXML());
    $dom->preserveWhiteSpace = false;
    $dom->formatOutput = true;
    echo $dom->saveXML();
    echo("ResponseHeaderMetadata:".$response->getResponseHeaderMetadata() . "\n");

  } catch (MarketplaceWebServiceProducts_Exception $ex) {
 echo("Caught Exception: " . $ex->getMessage() . "\n");
 echo("Response Status Code: " . $ex->getStatusCode() . "\n");
 echo("Error Code: " . $ex->getErrorCode() . "\n");
 echo("Error Type: " . $ex->getErrorType() . "\n");
 echo("Request ID: " . $ex->getRequestId() . "\n");
 echo("XML: " . $ex->getXML() . "\n");
 echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
 }

它有错误

  

PHP致命错误:类' MarketplaceWebServiceProducts_Client'在第16行的/var/www/html/amazon/src/MarketplaceWebServiceProducts/Samples/listMatching.php中找不到

0 个答案:

没有答案