PDA

View Full Version : convert php to perl -- writing xml



wuuf
July 31st, 2006, 06:52 PM
i need to take a simple php script that writes xml and convert it to a perl script

can anyone who knows perl give me a hand?

<?php
$filename = "/home/users/web/bbbb/xxxxx/htdocs/data/collection.xml";
$raw_xml = file_get_contents("php://input");

print $raw_xml;

$fp = fopen($filename, "w");
fwrite($fp,$GLOBALS['HTTP_RAW_POST_DATA']);
fclose($fp);
?>


thanks...

bwh2
August 1st, 2006, 11:45 AM
#!usr/bin/perl
use strict;
use warnings;

open OUTPUT, ">my_output_file.xml";
open INPUT, "my_input_file.xml";
while(<INPUT>) {
chomp( $_ );
print OUTPUT $_."\n";
}

close INPUT;
close OUTPUT;

that is your php script converted to using local files rather than post data. i don't have time now to look up perl form handling.

can you be a little more specific about what you're trying to do though?

wuuf
August 1st, 2006, 08:04 PM
flash standalone app creates and sends xml to server script which writes data to collection.xml file

this was working fine with the php script unfortunately we're moving to a new server that does not use php, thus i need a perl solution which i'm not very proficient at

thanks for your help...

bwh2
August 1st, 2006, 08:07 PM
ah. so what are you intending on using as your source for your xml?