xmlrpc php将xml记录到文本文件中

I am getting xmlrpc xml posted to my server and I want to catch the xml and store it in a text file for later processing.

This is what I have, but I just get a blank text file

$getXML = file_get_contents('php://input');
 $xml = new SimpleXMLElement($getXML);
 $text = $xml->Text;

 $today = date("Y-m-d");

 $randomnr = rand(100000, 999999);
 $datet = date("Ymd-H:i:s");
 $filename = "/var/www/".$datet."-".$randomnr.".txt";


 $fh = fopen($filename, 'w') or die("can't open file");
 fwrite($fh, $text);
 fclose($fh);

Can anyone see why I cam getting a blank text file?

I found This answer for your question

1)HTTP POST data is usually populated in $_POST, php://input will usually contain PUT data.

2)php://input cannot be opened/read when receiving a multipart/form-data POST, maybe that's what changed client-sided? – Wrikken Mar 28 at 20:01

file_get_contents('php://input') keeps returning empty

php://input returns empty

php://input returning empty string