emullaraj/ amazon-mws-products
Amazon Marketplace Web Service Products PHP 客户端库
dev-master
2018-11-29 07:48 UTC
Requires
- php: >=7.0
- ext-curl: *
This package is auto-updated.
Last update: 2024-09-29 04:49: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 返回 错误响应状态代码:0
?
如果您在尝试使用 cURL 向 Amazon MWS 发送请求时收到 错误响应状态代码:0
错误,请找到并设置 CURLOPT_SSL_VERIFYPEER
为 false
。
为什么 FeedSubmissionResult 会被截断?
当服务器响应被保存到内存中时会发生这种情况。为了避免这种情况,请将响应保存到文件中。
$responseFile = fopen("response.xml", "w");
fwrite($responseFile, $dom->saveXML());
fclose($responseFile);
/Mock
文件夹里有什么?
Mock 文件夹包含模拟 Amazon MWS 响应的预定义响应。Mock 响应对于在不实际向 Amazon MWS 发送请求的情况下进行测试非常有用。