当我在 linux cli 中使用亚马逊 MWS php API 时,代码会返回大量错误信息 - 输出以:-
About to connect() to mws.amazonservices.co.uk port 443 (#0)
Trying 178.236.4.102... connected
Connected to mws.amazonservices.co.uk (178.236.4.102) port 443 (#0)
Initializing NSS with cer....
实际的 PHP 代码如下:-
include_once ('MarketplaceWebService/.config.inc.php');
function SubmitFeed(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->submitFeed($request);
if ($response->isSetSubmitFeedResult()) {
$submitFeedResult = $response->getSubmitFeedResult();
if ($submitFeedResult->isSetFeedSubmissionInfo()) {
$feedSubmissionInfo = $submitFeedResult->getFeedSubmissionInfo();
if ($feedSubmissionInfo->isSetFeedSubmissionId())
{
return $feedSubmissionInfo->getFeedSubmissionId();
}
}
}
} catch (MarketplaceWebService_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");
}
}
$xml = '<?xml version="1.0" encoding="utf-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>xxxxxxxxxx</MerchantIdentifier>
</Header>
<MessageType>Inventory</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<Inventory>
<SKU>VWDTA29E</SKU>
<Quantity>41</Quantity>
</Inventory>
</Message>
</AmazonEnvelope>';
$xmlHandle = @fopen('php://temp', 'rw+');
fwrite($xmlHandle, $xml);
rewind($xmlHandle);
$md5 = base64_encode(md5(stream_get_contents($xmlHandle), true));
$parameters = array (
'Merchant' => MERCHANT_ID,
'FeedType' => '_POST_INVENTORY_AVAILABILITY_DATA_',
'FeedContent' => $xmlHandle,
'PurgeAndReplace' => false,
'ContentMd5' => $md5,
);
$request = new MarketplaceWebService_Model_SubmitFeedRequest($parameters);
echo $feedsubmissionid = SubmitFeed($service, $request);
我怎样才能阻止显示此信息,因为这仅在测试而不是生产中有用?
干杯