amazon-mws-unofficial/mws-fulfillment-inventory

dev-master 2015-10-27 11:40 UTC

This package is auto-updated.

Last update: 2024-09-04 09:24:04 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 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 文件夹里有什么?

Mock 文件夹包含模拟 Amazon MWS 响应的预定义响应。Mock 响应对于在不实际向 Amazon MWS 发送请求的情况下进行测试非常有用。