amazon-mws-unofficial/mws-subscriptions-service

将 Amazon MWS 代码库迁移到 composer 包

dev-master 2019-05-03 14:53 UTC

This package is auto-updated.

Last update: 2024-09-04 10:14:08 UTC


README

  1. 打开 /Samples/.config.inc.php

  2. 编辑以下行,用您的凭据替换 <>

    define('AWS_ACCESS_KEY_ID', '<Your Access Key ID>');
    define('AWS_SECRET_ACCESS_KEY', '<Your Secret Key>');
    
    define('APPLICATION_NAME', '<Your Application Name>');
    define('APPLICATION_VERSION', '<Your Application Version or Build Number>');
    
    define('MERCHANT_ID', '<Your Merchant Id>'); // If you are making calls on another seller's behalf, put their merchantID here.
    define('MARKETPLACE_ID', '<Your Marketplace Id>');
    

编辑示例

/Samples 文件夹中,您将找到与特定 Amazon Marketplace Web Service (Amazon MWS) 操作对应的文件。这些文件作为示例,说明进行该特定操作的代码。我们将以 Feeds API 部分的 SubmitFeed 操作为例。

  1. 打开 /Samples/SubmitFeedSample.php

  2. 取消注释相应的 $serviceURL 以使用您想要销售的市场。示例

    $serviceUrl = "https://mws.amazonservices.com";
    
  3. $feed 变量填充为馈送内容。示例

    // From a string
    $feed = "Feed content";
    
    // From a file
    $feed = file_get_contents("feed.txt");
    
  4. 取消注释 $marketplaceIdArray 并填充数组,其中包含您想要提交馈送到其上的 MarketplaceId 值。

  5. 在 126-170 行之间取消注释两种 Amazon MWS 请求构建方法之一。

  6. 取消注释以下行

    invokeSubmitFeed($service, $request);
    
    @fclose($feedHandle);
    
  7. 启动您的服务器并导航到脚本的地址以运行它。

常见问题解答

为什么 cURL 返回 Error Response Status Code: 0

如果您在尝试使用 cURL 向 Amazon MWS 发送请求时收到 Error Response Status Code: 0 错误,请找到并设置 CURLOPT_SSL_VERIFYPEERfalse

为什么 FeedSubmissionResult 被截断?

当服务器响应保存到内存中时,会发生此情况。为了避免这种情况,将响应保存到文件中。

$responseFile = fopen("response.xml", "w");
fwrite($responseFile, $dom->saveXML());
fclose($responseFile);

/Mock 文件夹中有什么?

模拟文件夹包含模拟 Amazon MWS 响应的 canned responses。模拟响应对于在实际向 Amazon MWS 发送请求之前进行测试非常有用。