receive xml file via post in php

Posted by thegunner on Stack Overflow See other posts from Stack Overflow or by thegunner
Published on 2009-06-02T10:20:29Z Indexed on 2010/04/06 10:13 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

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,

© Stack Overflow or respective owner

Related posts about php

Related posts about http