receive xml file via post in php
- by thegunner
Hi,
I'm looking for a PHP script that can accept an XML file via a POST, then send a response....
Does anyone have any code that could do this?
So far the only code I have is this but not sure about the response or if indeed I am even going in the right direction as XML characters are not saved correctly. Any ideas?
<?php
if ( $_SERVER['REQUEST_METHOD'] === 'POST' ){
$postText = file_get_contents('php://input');
}
$datetime=date('ymdHis');
$xmlfile = "myfile" . $datetime . ".xml";
$FileHandle = fopen($xmlfile, 'w') or die("can't open file");
fwrite($FileHandle, $postText);
fclose($FileHandle);
?>
Thanks,