22 lines
453 B
PHP
22 lines
453 B
PHP
<?php
|
|
$rest_json = file_get_contents("php://input");
|
|
$_POST = json_decode($rest_json, true);
|
|
|
|
|
|
//var_dump($_POST);
|
|
|
|
$fp = fopen('../data/stock-v2.json', 'w');
|
|
$result = fwrite($fp, json_encode($_POST["v2"]));
|
|
fclose($fp);
|
|
|
|
$fp = fopen('../data/stock.json', 'w');
|
|
$result = fwrite($fp, json_encode($_POST["v1"]));
|
|
fclose($fp);
|
|
|
|
if ($result) {
|
|
echo 'Réussite !';
|
|
} else {
|
|
echo 'Echec!
|
|
'; // Allows to create a newline
|
|
var_dump($_POST);
|
|
}
|