0

When I am using the Amazon MWS php API in a linux cli the code is returning a load of bebug information - output starts with:-

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....

Actual PHP Code is as follows:-

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);

How can I stop this information from being shown as this is only useful in testing and not production?

Cheers

aynber
  • 22,380
  • 8
  • 50
  • 63
l0ckm4
  • 757
  • 5
  • 17

2 Answers2

2

Found it - in Client.php in private function getDefaultCurlOptions rem out or set CURLOPT_VERBOSE = false!

l0ckm4
  • 757
  • 5
  • 17
0

Can't help with that, I am facing same problem and its difficult to track your output as well. But try editing Feeds API class files by tracking down echo statements if there are any!

Best Luck...

Keyur Padalia
  • 2,077
  • 3
  • 28
  • 55
  • There are no echo's, var-dumps, print_r's that I can see. I have tried ob_start() and ob_end_flush() around the function call but that does not work either! I am confused! – l0ckm4 Apr 23 '13 at 10:41
  • 1
    Found it - in Client.php in private function getDefaultCurlOptions rem out or set CURLOPT_VERBOSE = false! :-) – l0ckm4 Apr 23 '13 at 10:48