emullaraj / amazon-mws-sellers
Amazon Marketplace Web Service Sellers PHP 客户端库
dev-master
2022-07-21 11:10 UTC
Requires
- php: >=7.0
- ext-curl: *
This package is auto-updated.
Last update: 2024-09-21 15:43:22 UTC
README
-
打开
/Samples/.config.inc.php
-
编辑以下行,将
<>
值替换为您的凭据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 操作作为示例。
-
打开
/Samples/SubmitFeedSample.php
-
取消注释您想要在该市场上销售的市场的相应
$serviceURL
。示例$serviceUrl = "https://mws.amazonservices.com";
-
用馈送内容填充
$feed
变量。示例// From a string $feed = "Feed content"; // From a file $feed = file_get_contents("feed.txt");
-
取消注释
$marketplaceIdArray
并在数组中填充您想要提交馈送到的 MarketplaceId 值。 -
在 126-170 行之间取消注释两个 Amazon MWS 请求构建方法之一。
-
取消注释以下行
invokeSubmitFeed($service, $request); @fclose($feedHandle);
-
启动您的服务器并导航到脚本的地址以运行它。
常见问题解答
为什么 cURL 返回 Error Response Status Code: 0
?
如果您在尝试使用 cURL 向 Amazon MWS 发送请求时收到 Error Response Status Code: 0
错误,请查找并设置 CURLOPT_SSL_VERIFYPEER
为 false
。
为什么 FeedSubmissionResult 被截断?
这发生在服务器响应保存到内存中时。为了避免这种情况,将响应保存到文件中。
$responseFile = fopen("response.xml", "w");
fwrite($responseFile, $dom->saveXML());
fclose($responseFile);
/Mock
文件夹里有什么?
mock 文件夹包含模拟 Amazon MWS 响应的预定义响应。Mock 响应对于在不实际向 Amazon MWS 发送请求的情况下进行测试很有用。