serzh / amazon-mws-products
此软件包最新版本(v1.0.5)没有提供许可信息。
Amazon Marketplace Web Service PHP客户端库
v1.0.5
2019-11-29 11:35 UTC
Requires
- php: >=5.4
README
版本:2016-06-01
安装
composer require serzh/amazon-mws-products
输入您的凭据
-
打开
/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之前进行测试非常有用。