You can try this code it will give you more information about what is going on in your script.
Then check the response in you android code.
<?php
// array for JSON response
$response = array();
// Check request method -- for some reason??
if($_SERVER["REQUEST_METHOD"]=="POST"){
// check for required fields
if (isset($_POST['OrderSummary'])) {
$data = $_POST['OrderSummary'];
$json = json_decode($data,true);
$my_file = 'text.txt';
$result = file_put_contents($my_file,$json);
$response["success"] = 1;
$response["message"] = "Number of bytes written = " .$results;
}
else{
$response["success"] = 0;
$response["message"] = "Parameters not correctly formatted";
}
else{
$response["success"] = 2;
$response["message"] = "Somebody is not using the POST request method!";
}
echo json_encode($response);
?>
Edit:
I'm not quite sure why you are checking the request method. But I kept it in the PHP script anyway.