} } if ($downloadFileResponse->ack !== 'Failure') { /** * Check that the response has an attachment. */ if ($downloadFileResponse->hasAttachment()) { $attachment = $downloadFileResponse->attachment(); /** * Save the attachment to file system's temporary directory. */ $filename = saveAttachment($attachment['data']); if ($filename !== false) { $xml = unZipArchive($filename); if ($xml !== false) { $responses = $merchantDataService->setShipmentTrackingInfo($xml); foreach ($responses as $response) { if (isset($response->Errors)) { foreach ($response->Errors as $error) { printf("%s: %s\n%s\n\n", $error->SeverityCode === MerchantData\Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning', $error->ShortMessage, $error->LongMessage); } } if ($response->Ack !== 'Failure') { printf("OrderLineItemID %s\n", $response->OrderLineItemID); } } } } } else { print "Unable to locate attachment\n\n"; }