1

I have function that run web-service and bring me binary file:

$params->xmlRequest = $paramsStr;

$result = $s->__call("SubmitXmlString",array($params));

$obj_pros = get_object_vars($result);
$xml =  $obj_pros['SubmitXmlStringResult']; 
$xml = simplexml_load_string($xml); 

return ($xml);  

example for response:

<PnrGetReportDoc ReportName="ExternalDocument">
    <Report ID="6214" Type="pdf" Name="file name" IsCompressed="1">
        <![CDATA[JVBERi0xLjcNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAQolJU......................VPRg==]]>
        </Report>
    <ReportImages>
</ReportImages>
</PnrGetReportDoc>

I would like to ECHO the content in order to display the file

I tried to echo the binary but: 1. PDF isn't display

  1. binary characters start without the opening notes: <![CDATA[

This is my php file where i'm trying to display the file:

header('Content-type: application/'pdf);
$fileData = get_file_data ($_GET['fileID']);

echo $fileData->Report;

1 Answer 1

1

That is not binary. Precisely, XML is well known for being a plain text data format.

From the sample data you've shared I imagine it's Base64, a popular algorithm to encode binary data as plain text. PHP has a native function to decode it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.