Question

I have been scouring the internet trying to figure this one out. Any ideas would help. I'm trying to take an .xfdl file (base64gzip of XML) from my server and convert it to .xml with PHP for viewing and modification but, I can't see to figure out this process. I've seen people try to with Ruby but, I don't know any Ruby. If no one can help, I guess I'll be learning Ruby hahaha! Thanks in advanced. Also, I have looked through this website and couldn't find any php examples of this.

Was it helpful?

Solution

Assuming the XML is gzipped first and then base64 encoded, you can use base64_decode() and gzdecode().

echo gzdecode(base64_decode(file_get_contents('file.xfdl')));

However if you're not running on a Windows box, you will need to compile PHP with --with-zlib to include the zlib library and functions.

Once you have it in XML form, you might want to look at XMLReader to see how you can modify and read XML in PHP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top