Reputation: 31
I'm able to parse the XML received from Docusign Connect properly, but I'm running into issues saving the PDFBytes into a PDF file to be viewed later. The following is a snippet of the code I'm using.
$filename = $xml->DocumentPDFs->DocumentPDF->Name;
$contents = $xml->DocumentPDFs->DocumentPDF->PDFBytes;
file_put_contents($filename, $contents);
When I try opening the file, the viewer doesn't understand what the file is.
Am I missing anything?
Upvotes: 3
Views: 428
Reputation: 13480
(Posting your comment as an answer, so that others can benefit from this information in the future.)
$contents is base64-encoded, so you need to use base64_decode -- like this:
file_put_contents($filename, base64_decode($contents));
Upvotes: 2