I am posting a string xml data to a php page hosted in IIS. All I want is to be able to read the string data that I receive in php page and write it to a file. But am not able to achieve the same. Here is my code:-
<?php
if($_SERVER['REQUEST_METHOD'] == "POST"){
echo "Hello
";
$somecontent = print_r($_POST, TRUE);
$my_file = "resp.txt";
$handle = fopen($my_file, "w") or die('Cannot open file: '.$my_file);
fwrite($handle, $somecontent);
}else {
echo "Error
";
}
?>
But am not able to create the file or read the POST contents. I would be glad if someone would figure out how to solve this.