2019-08-01 10:17:45 +02:00
|
|
|
<?php
|
|
|
|
$rest_json = file_get_contents("php://input");
|
|
|
|
$_POST = json_decode($rest_json, true);
|
|
|
|
|
|
|
|
|
|
|
|
//var_dump($_POST);
|
|
|
|
|
2019-09-12 00:08:46 +02:00
|
|
|
$fp = fopen('../data/stock-v2.json', 'w');
|
|
|
|
$result = fwrite($fp, json_encode($_POST["v2"]));
|
|
|
|
fclose($fp);
|
|
|
|
|
2019-08-01 10:17:45 +02:00
|
|
|
$fp = fopen('../data/stock.json', 'w');
|
2019-09-12 00:08:46 +02:00
|
|
|
$result = fwrite($fp, json_encode($_POST["v1"]));
|
2019-08-01 10:17:45 +02:00
|
|
|
fclose($fp);
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
echo 'Réussite !';
|
|
|
|
} else {
|
|
|
|
echo 'Echec!
|
|
|
|
'; // Allows to create a newline
|
|
|
|
var_dump($_POST);
|
|
|
|
}
|