I don't know php at all and try to rewrite an example of using php with android
I want my android app to send some data - name and message and receive list of this data as JSON
now - what I have from my example :
<?php
// Get Post Data
$data = urldecode($_POST['data']);
$name = urldecode($_POST['name']);
$jsonData = array();
$jsonTempData = array();
$jsonTempData = array();
$jsonTempData['name'] = $name;
$jsonTempData['number'] = $data;
$jsonTempData['date_added'] = // I don't know how to set date
$jsonData[] = $jsonTempData;
$outputArr = array();
$outputArr['Android'] = $jsonData;
// Encode Array To JSON Data
print_r( json_encode($outputArr));
?>
which means I send some data and get it back in one method which is , I assume, wrong. how can I separate them - sending data to php and receiving json.i have to repeat, I got zero knowledge in php.
Plus it's only one name-message pair wrapped into array and what I need is to make array of this messages and return them in JSON.Oh, and I need to write time of message into array
thank you