【问题标题】:Remove DEBUG information from amazon mws php api从 amazon mws php api 中删除 DEBUG 信息
【发布时间】:2013-04-23 09:01:27
【问题描述】:

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

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

干杯

【问题讨论】:

    标签: php amazon amazon-mws


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      祝你好运……

      【讨论】:

      • 我看不到 echo、var-dump、print_r。我已经在函数调用周围尝试了 ob_start() 和 ob_end_flush() ,但这也不起作用!我很困惑!
      • 找到了 - 在 Client.php 中的私有函数 getDefaultCurlOptions rem out 或设置 CURLOPT_VERBOSE = false! :-)
      猜你喜欢
      • 1970-01-01
      • 2012-08-25
      • 2016-12-22
      • 2013-02-14
      • 2020-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多