douya2982 2015-10-17 20:05
浏览 119
已采纳

亚马逊MWS GetReport错误

I was trying to get the information regarding the Product catalog via _GET_WEBSTORE_PRODUCT_CATALOG_ ReportType. I was succesfull in submitting the report request and even it was processed and even the processing status was DONE and generated id was also collected. But when I try to get the report via the Action: GetReport it gives an Market place is not sent, even though the market place was mentioned. Below is the sample of codes and I m not using any of the PHP client library....

Code Sample

<?php

require 'config.php';    
$param = array(
    'AWSAccessKeyId'=> AWS_KEY,
    'Action'=>'GetReport',

    'ReportId'=>'513798174016724',
    'Merchant'=> MERCHANT_ID,
    'SignatureMethod' => "HmacSHA256",
    'SignatureVersion'=> "2",
    'Timestamp'=> gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()),
    'Version' => "2009-01-01",
    'Marketplace'=>MARKETPLACE
);
$secret = AWS_SECRET_ACCESS_KEY;
$url = array();
foreach ($param as $key => $val) {
    $key = str_replace("%7E", "~", rawurlencode($key));
    $val = str_replace("%7E", "~", rawurlencode($val));
    $url[] = "{$key}={$val}";
}    
sort($url);
$arr   = implode('&', $url);
$sign  = 'POST' . "
";
$sign .= 'mws.amazonservices.com' . "
";
$sign .= '/' . "
";
$sign .= $arr;    
$signature = hash_hmac("sha256", $sign, $secret, true);
$signature = urlencode(base64_encode($signature));    
$link  = "https://mws.amazonservices.com/?";
$link .= $arr . "&Signature=" . $signature;
$curl = curl_init();
curl_setopt_array($curl, array(

    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => $link,
    CURLOPT_POST => 1,

    )
);  

$resp1 = curl_exec($curl);    
curl_close($curl);    
print_r($resp1);

And error Sample Please indicate a marketplace for which the report is required. Is there anything I am missing... or where I have mistyped something ... Thanks for the solution in advance..

展开全部

  • 写回答

1条回答 默认 最新

  • dongya1875 2015-10-19 05:30
    关注

    Try changing to these

    $request = new MarketplaceWebService_Model_RequestReportRequest();
    
    $marketplaceIdArray = array("Id" => array($marketplace_id));
    $request->setMarketplaceIdList($marketplaceIdArray);
    $request->setMerchant($merchant_id);
    $request->setReportType($this->report_type);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部