Skip to content
Advertisement

How to avoid SoapClient PHP to decode base64 response result?

Am using SoapClient (PHP) to retrieve data from a remote webservice. And I am able to communicate perfectly with this webservice. The request am sending is supposed to retrieve base64 encoded image data.

It turned out that SoapClient automatically decode base64 response and the result looks like this:

b"PKx03x04-x00x00x00x08x00.d!UÉVÆ│        x00x14x00report.pdfx01x00x10x00gx12x00x00x00x00x00x00┌tx00x00x00x00x00x00ýX{tx14ıx19'x01óØ▓mO╩1Ðx02╣«F@Ï╠{gx07ÆÓ¯,ø╔µMêBö╔¯d3╔¯╠23øWvÕ`j┼x17x1EETT¼¿Áx05Z± ...

My question is how prevent this automatic decoding by SoapClient. My REST API need to transfer the base64 string as it is to another service.

Advertisement

Answer

Definitely, I just had to encode back to Base64.

Advertisement