开发亚马逊 MWS中feed上传修改商品信息 通过GetFeedSubmissionResult来判断上传数据是否成功

GetFeedSubmissionResultSample.php 中的方法如下

$config = array (
'ServiceURL' => $serviceUrl,
'ProxyHost' => null,
'ProxyPort' => -1,
'MaxErrorRetry' => 3,
);

$service = new MarketplaceWebService_Client(
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
$config,
APPLICATION_NAME,
APPLICATION_VERSION);

$request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest($parameters);

$parameters = array (
'Merchant' => MERCHANT_ID,
'FeedSubmissionId' => '

$response = $service->getFeedSubmissionResult($request);

结果获取不到xml数据,不能分析出上传是否成功

重点@fopen('php://memory', 'rw+'), 把结果放在内存中,就取不出来了,改为文件保存

修改为

$handle = fopen(__DIR__.'/xmlfile.xml', 'w+');  
    
    $parameters = array (
      'Merchant' => MERCHANT_ID,
      'FeedSubmissionId' => $feedSubmissionId,
      'FeedSubmissionResult' => $handle,
      'MWSAuthToken' => MWSAUTHTOKEN, // Optional
);

$response = $service->getFeedSubmissionResult($request);
fclose($handle);
$tempFile = DIR.'/xmlfile.xml';
$xmlFile = file_get_contents($tempFile);
$dom = new DOMDocument();
$dom->loadXML($xmlFile);
$dom->preserveWhiteSpace = false;

下面就做xml解析 .............

扫描二维码关注公众号,回复: 3840954 查看本文章

得出想要的xml数据

猜你喜欢

转载自www.cnblogs.com/liu201312/p/9885303.html