I'm creating the WebSocket based application with Codeigniter. So, data is coming as a JSON string(not a POST Method). I want to use the Codeigniter's built-in form_validation method to validate the data received as JSON.
this is what I tried so far to set the variable so I can access it through $this->input->post('variable_name') but.
Try #1
$_POST['variable_name'] = !isset($data['variable_name']) ? NULL : $data['variable_name'];
Try #2
$variable_name = !isset($data['variable_name']) ? NULL : $data['variable_name'];
$this->form_validation->set_value("variable_name", $variable_name);
But when I use $this->input->post('variable_name')
it returns NULL.