1 |
4307
|
leinfelder
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
4 |
|
|
$Id: serializer.php 2142 2006-06-28 10:16:57Z steven $
|
5 |
|
|
$Name$
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
9 |
|
|
// Description:
|
10 |
|
|
// Script to serialize incoming data and return a reference to the file.
|
11 |
|
|
//
|
12 |
|
|
// Author: Nedjo Rogers
|
13 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
// Set save directory. This should be set to a writable, web-accessible directory.
|
17 |
|
|
$outputDir = "/temp";
|
18 |
|
|
|
19 |
|
|
// Read in data.
|
20 |
|
|
$data = $GLOBALS["HTTP_RAW_POST_DATA"];
|
21 |
|
|
|
22 |
|
|
// Create file and save data to it.
|
23 |
|
|
$tmpfname = tempnam($outputDir, "cmb") . ".xml";
|
24 |
|
|
|
25 |
|
|
$handle = fopen($tmpfname, "w");
|
26 |
|
|
fwrite($handle, $data);
|
27 |
|
|
fclose($handle);
|
28 |
|
|
|
29 |
|
|
// Send xml content type header.
|
30 |
|
|
header("Content-type: text/xml");
|
31 |
|
|
|
32 |
|
|
// Return XML snippet with file reference.
|
33 |
|
|
echo '
|
34 |
|
|
<XmlSerializer xmlns:xlink="http://www.w3.org/1999/xlink">
|
35 |
|
|
<OnlineResource xlink:type="simple" xlink:href="' . $tmpfname . '"/>
|
36 |
|
|
</XmlSerializer>';
|
37 |
|
|
?>
|