title: Get data using post request in REST API Codeigniter
body: <p>I am working with REST API for the first time in codeigniter.
  I have following function in api</p>
  
  <pre><code> public function cource_topics_post() {
          $username = $this-&gt;input-&gt;post('username');
          //$value=$this-&gt;uri-&gt;segment(3);
          $this-&gt;response(array('status' =&gt; 1, 'username' =&gt;  $username ));       
      }
  </code></pre>
  
  <p>but </p>
  
  <pre><code>$username = $this-&gt;input-&gt;post('username');
  </code></pre>
  
  <p>isn't working. need help</p>
  
  <p>My controller is as follows</p>
  
  <pre><code>    &lt;?php
  
  header("Access-Control-Allow-Origin: *");
  require(APPPATH . '/libraries/REST_Controller.php');
  
  class Admin extends REST_Controller {
      function __construct() {
          parent::__construct();
          $this-&gt;load-&gt;helper('file');
          $this-&gt;load-&gt;helper(array('form', 'url'));
      }
  
      public function cource_topics_post() {
          $username = $this-&gt;post('username');
          $password = $this-&gt;post('password');
          //$value=$this-&gt;uri-&gt;segment(3);
          $user = "faizan";
          $pass = "faizan";
          if($username == $user &amp;&amp; $password == $pass){
              $this-&gt;response(array('status' =&gt; 1, 'logged in as' =&gt;  $username ));
          }
          else{
              $this-&gt;response(array('status' =&gt; 0, 'Could not login' =&gt; 'incorrect username password'));
          }
      }
  
  }
  </code></pre>
  
  <p>I am using rest_controller. </p>