如何通过XML传输PHP数组?

I have an XML document that is encrypted using a proprietary encryption program like so: exec($programName, $outputArr, $returnVal);

The resulting array ($outputArr) was serialized and stored as a blob in MySQL. I was making this encrypted array available on demand through a web interface. Basically deserializing and writing to a file on the fly.

Now the requirements have changed and I need to make this encrypted array available to another server which uses .net/c# and which in turn will host the web interface. We are using a REST API that responds to a GET request and sends out an XML response.

I tried writing the array into a temporary file and then retrieving the contents of the file using file_get_contents($tempFile) and then URL encoding the resulting string and putting that inside of the XML response that I was sending.

Of course, when the new web interface writes this out as a file (after URL decoding), it's nothing like it's supposed to be. By that, I mean our proprietary program throws up errors on reading this new resulting file ... somewhere along the way, there's data corruption happening.

We also tried a C# serialization library that deserialized PHP arrays into a c# primitive type but that wasn't a good solution either as it kept throwing up a bunch of errors.

Is there a better way to do this?

Why not just access the working version, and re-manipulate it before sending to the new server...

<!-- Some XML based wrapper or other logic/output -->
<?php
  echo file_get_contents($url_to_working_web_interface);
?>