POST data to permant json file using PHP
- by doxsi
using a url, my idea is the any user can post data. For example via
http://myweb.com/index.php?name=Peter&surname=Brown
Using the "jedwards" answer, present here , I am hable to create a json an d save it to a file.
<?
/* This needs to be at the top of your file, without ANYTHING above it */
session_start();
/* ... */
if(!array_key_exists('entries', $_SESSION))
{
$_SESSION['entries'] = array();
}
$_SESSION['entries'][] = array("name" => $_GET["name"], "surname" => $_GET["surname"]);
$json_string = json_encode($_SESSION['entries']);
My problem is taht his is not permant amongst different session or user. It work only on the same session. On different sessionthe json built start from the beginning.
Any idea about that?