سؤال

I have an integration project with ERP system that return me a list of invoices compressed with zip as binary string:

Xc1NCsIwEEDhq0j2ZuIPCEWF4qqgNNCN2yFWGzAzMhmMvb1g0YUHeN/b1iI4tlcvkSXq2NCTY+hnr3SnvDOD6qMCyGHoE2Z7QcXApIJBLcsNls6twW1gyn3b1b6xB06Jyf6R2UxoFX9sKcWW1RdawPl07D6neaSsSKE3sH8D

I can't success to extract it, I try with gzuncompress(), new ArchiverZip() also try to convert it from bin2hex, base64 ... and nothing, I should get an object from this string.

The guys which develop the ERP system, told me that they are compress it with Ionic (??): Ionic.Zlib.DeflateStream.UncompressBuffer(compressedData);

Any ideas ? Thanks

هل كانت مفيدة؟

المحلول

That data is compressed with raw deflate (no zlib, gzip, or zip wrapper around the deflate data), and base64 encoded. Decoded and decompressed, it's:

<ArrayOfPriorityInvoice xmlns="http://schemas.datacontract.org/2004/07/PrioriPOSAPI.Common.PriorityInvoices" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/>

Use base64_decode() and gzinflate() to extract the data.

نصائح أخرى

Try to read the string using file_get_contents

Then write a zip file into a tmp folder, then extract it

Tell me if you need further explaination

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top