当我在linux cli中使用亚马逊MWS php API时,代码返回一堆bebug信息 - 输出以: -
开头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);
如何阻止显示此信息,因为这仅用于测试而非生产?
干杯
答案 0 :(得分:2)
在私有函数getDefaultCurlOptions中的Client.php中找到它或者设置CURLOPT_VERBOSE = false!
答案 1 :(得分:0)
无法解决这个问题,我遇到同样的问题,也很难跟踪你的输出。但是,如果有的话,请通过跟踪echo语句来编辑Feeds API类文件!
祝你好运......