我已經使用AMAZON MWS Marketplace網絡服務訂單獲取訂單API .. 我已正確配置。但遇到如下錯誤:「Caught Exception:拒絕訪問響應狀態代碼:401錯誤代碼:AccessDenied錯誤類型:發件人請求ID:9bc2e235-218c-4245-b63e-7d93bc6f1da0 XML:發件人AccessDenied訪問被拒絕9bc2e235-218c-4245-b63e -7d93bc6f1da0 ResponseHeaderMetadata:的requestId:9bc2e235-218c-4245-b63e-7d93bc6f1da0,ResponseContext:98sqo3AP9MOvPqqfRnPTHw15yXGOIPaK8j3OBLilY + Fp的// ta5MYQwxJaYrV7AZLBcei5I2EWYJoq 53tbCvpcJQ ==,時間戳:2016-04-30T11:20:03.130Z,配額最大:,配額剩餘:,配額復位在:「亞馬遜市場PHP獲取訂單API
我的代碼如下
public function list_of_order_items()
{
include_once (DOCROOT."application/vendor/amazon-mws-sdk-master/lib/MarketplaceWebServiceOrders/Samples/config.inc.php");
$config = array (
'ServiceURL' => "https://mws.amazonservices.com/Orders/2013-09-01",
'ProxyHost' => null,
'ProxyPort' => -1,
'ProxyUsername' => null,
'ProxyPassword' => null,
'MaxErrorRetry' => 3,
);
$service = new MarketplaceWebServiceOrders_Client(
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
APPLICATION_NAME,
APPLICATION_VERSION,
$config);
$request = new MarketplaceWebServiceOrders_Model_GetOrderRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
$response = $this->invokeGetOrder($service, $request);
}
public function invokeGetOrder(MarketplaceWebServiceOrders_Interface $service, $request)
{
try {
$response = $service->GetOrder($request);
回聲」
"; print_r($response); exit;
echo ("Service Response\n"); echo ("=============================================================================\n");$dom = new DOMDocument(); $dom->loadXML($response->toXML()); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; echo $dom->saveXML(); echo("ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n"); } catch (MarketplaceWebServiceOrders_Exception $ex) { echo("Caught Exception: " . $ex->getMessage() . "\n"); echo("Response Status Code: " . $ex->getStatusCode() . "\n"); echo("Error Code: " . $ex->getErrorCode() . "\n"); echo("Error Type: " . $ex->getErrorType() . "\n"); echo("Request ID: " . $ex->getRequestId() . "\n"); echo("XML: " . $ex->getXML() . "\n"); echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n"); }
}
這可以幫助你,但你必須閱讀的問題和拉請求,因爲它有一個小bug(它的速度非常快修復)https://github.com/CPIGroup/phpAmazonMWS/tree/master – cartalot