0

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?

tim berspine
  • 825
  • 1
  • 9
  • 17

1 Answers1

0

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);
?>
Billy Moon
  • 57,113
  • 24
  • 136
  • 237
  • That's a great suggestion but there is no fixed resource on the web interface. It basically utilizes session information to generate a dynamic link which then just barfs the array into the browser and asks the browser to treat it as a file that's to be downloaded. – tim berspine Feb 21 '13 at 00:35
  • although this does make me wonder ... should I be using `file_get_contents()` or something else like `readfile()` or `fpassthru()` or just `fread()`? – tim berspine Feb 21 '13 at 00:37