I write some log file on my server after the submit data from other server automatically when my payment is success. my cookies log file are working well but after the loop it not working.
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$roomname = $_POST['roomname'];
$cartinfo = $_POST['cartinfo'];
$str = substr_replace($cartinfo, $roomname, 2, 0);
$arrs = explode(",", $str);
$numArrs = array_shift($arrs);
array_walk($arrs, function(&$val, $key) { $val = explode(';',$val); });
//work at this step
// $payload ="hello";
// $steal = fopen("1.txt", "a");
// fwrite($steal, $payload ."\n");
// fclose($steal);
$ans = array();
for($i=0; $i<$numArrs; $i++) {
$ans[] = array_column($arrs, $i);
}
//Not working....
$payload ="hello";
$steal = fopen("1.txt", "a");
fwrite($steal, $payload ."\n");
fclose($steal);
foreach ($ans as $key => $value) {
$roomname = $value[0];
$roomqty = $value[1];
$arrival = $value[2];
$departure= $value[3];
//insert data into database
}
}
?>
The post method will be submit by other server automatically. I goal is to insert data in the loop if the payment is succes..