我正在使用亚马逊 MWS CreateInboundShipmentPlan 创建发货计划,如果我将我的产品限制在 23-24 以内,它会工作得很好,但是如果我尝试提交超过 24 个,它会给我 InvalidAddress 错误。我正在使用 PHP API 向亚马逊 MWS 提交请求。在最初的故障排除中,我认为这完全与 URL 长度有关,因为如果我通过添加更多 SKU 来增加 URL 长度,它就会开始出现问题。
如果我尝试使用有限数量的 SKU,我会得到成功的结果。
但是如果我尝试使用更多 SKU,它会给我
[错误] => 数组( [类型] => 发件人 [代码] => 无效地址 [消息] => 在此服务器上找不到资源 /errors/mws.amazonservices.com/500.html。)
这是我的 PHP 代码。
function amazon_CreateInboundShipmentPlan($amazonAWSAccessKeyId,$amazonSellerId,$amazonMWSAuthToken,$amazonMarketPlaceId,$amazonSecretKey,$domain,$extras){
$param = array();
$param['AWSAccessKeyId'] = $amazonAWSAccessKeyId;
$param['Action'] = 'CreateInboundShipmentPlan';
$param['SellerId'] = $amazonSellerId;
$param['MWSAuthToken'] = $amazonMWSAuthToken;
$param['SignatureMethod'] = 'HmacSHA256';
$param['SignatureVersion'] = '2';
$param['Timestamp'] = gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time());
$param['Version'] = '2010-10-01';
$param = array_merge($param,$extras);
$secret = $amazonSecretKey;
$url = array();
foreach ($param as $key => $val) {
$key = str_replace("%7E", "~", rawurlencode($key));
$val = str_replace("%7E", "~", rawurlencode($val));
$url[] = "{$key}={$val}";
}
$amazon_feed = '';
sort($url);
$arr = implode('&', $url);
$sign = 'POST' . "\n";
$sign .= 'mws.amazonservices.'.$domain.'' . "\n";
$sign .= '/FulfillmentInboundShipment/'.$param['Version'].'' . "\n";
$sign .= $arr;
$signature = hash_hmac("sha256", $sign, $secret, true);
$httpHeader = array();
$httpHeader[] = 'Transfer-Encoding: chunked';
$httpHeader[] = 'Content-Type: application/xml';
$httpHeader[] = 'Content-MD5: ' . base64_encode(md5($amazon_feed, true));
$httpHeader[] = 'Expect:';
$httpHeader[] = 'Accept:';
我认为 URL 长度有问题。请帮我弄清楚这段代码到底有什么问题。
智慧大石