I recieve an XML-response from an API that looks something like this;
<?xml version="1.0" encoding="ISO-8859-1"?>
<tppxmlresponse>
<requestvalid>1</requestvalid>
<invoicevalid>1</invoicevalid>
<invoicepdf><![CDATA[%PDF-1.3
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
% 'BasicFonts': class PDFDictionary
1 0 obj
% The standard fonts dictionary
<< /F1 2 0 R
/F2 3 0 R
/F3+0 11 0 R >>
endobj
(....)
startxref
110364
%%EOF
]]></invoicepdf></tppxmlresponse>
<invoicepdf>
contains raw PDF that I'm looking to fetch. But using the regular new SimpleXMLElement($response);
on the response returns the following error;
PHP Fatal error: Uncaught Exception: String could not be parsed as XML in (...)
Any ideas to best access the contents of <invoicepdf>
, stripping away the XML, would be awesome. Thanks!