0

当我在 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);

我怎样才能阻止显示此信息,因为这仅在测试而不是生产中有用?

干杯

4

2 回答 2

2

找到它 - 在 Client.php 中的私有函数 getDefaultCurlOptions rem out 或设置 CURLOPT_VERBOSE = false!

于 2013-04-23T10:50:49.597 回答
0

对此无能为力,我面临同样的问题,并且也很难跟踪您的输出。但是尝试通过跟踪 echo 语句来编辑 Feeds API 类文件(如果有的话)!

好运...

于 2013-04-23T09:58:02.797 回答