Site du proximo, utilisé pour gérer le stock.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

write_json.php 340B

123456789101112131415161718
  1. <?php
  2. $rest_json = file_get_contents("php://input");
  3. $_POST = json_decode($rest_json, true);
  4. //var_dump($_POST);
  5. $fp = fopen('../data/stock.json', 'w');
  6. $result = fwrite($fp, json_encode($_POST));
  7. fclose($fp);
  8. if ($result) {
  9. echo 'Réussite !';
  10. } else {
  11. echo 'Echec!
  12. '; // Allows to create a newline
  13. var_dump($_POST);
  14. }