I'm trying to get proper output in json format but my output below is a bit messy. It should be like this:
"{"table":"users","operation":"select","username":"inan"}"
How can I solve my problem?
Thanks
server.php
print_r($_POST);
client.php
$data = array('table'=>'users', 'operation'=>'select', 'uid'=>'yoyo');
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($curl_handle);
if ($this->request_response_type == 'array')
{
echo $output;
}
else if ($this->request_response_type == 'json')
{
echo json_encode($output);
}
else if ($this->request_response_type == 'xml')
{
//xml conversion will be done here later. not ready yet.
}
output:
"Array\n(\n [table] => users\n [operation] => select\n [uid] => yoyo\n)\n"
$this->request_response_typeis returning 'json' and remember it is case sensitive so 'Json' != 'json'.