I'm facing this issue with POST in CodeIgniter which is not working while if I switch to GET, that works fine.
Login Controller
public function login_check(){
print_r($this->input->post());
if($this->input->post('email')!=NULL){
echo '1';
}
else{
header('Content-Type: application/json');
echo json_encode( array('a' => $this->input->post('email')));
}
CSRF is set to false in config file, while base url is set to http://localhost/xyz/
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Routes
$route['api/login-check'] = 'login/login_check';
If I set $this->input->get('email')
while setting method GET in postman, that works absolutely okay.
What's something that I'm missing? Any help in this will be appreciated.
EDIT:
Response from postman:
Array() {"a":null}