title: Catch session id in codeigniter
body: <p>I wanna to know how to catch session id from device/client.</p>
  
  <p>I have a Login API, the logic is like this. When client login to the apps they are also get an session id. the code is below:</p>
  
  <pre><code>public function user_post()
  {
    $data = array (
      'username' =&gt; $this-&gt;input-&gt;get_post('username'),
      'password' =&gt; sha1($this-&gt;input-&gt;get_post('password'))
    );
  
    $result = $this-&gt;login_m-&gt;user_check($data);
    if ($result ) {
       foreach ($result as $row ) {
  
        $sess_array = array(
                    'username' =&gt; $row-&gt;username,
                    'email'    =&gt; $row-&gt;email,
                    'uniqueID' =&gt; $row-&gt;uniqueID,
                    'userid'   =&gt; $row-&gt;userid,
                    'session_id' =&gt; session_id()
  
                    );
  
        $this-&gt;session-&gt;set_userdata('logged', $sess_array);
        $this-&gt;response(array('success' =&gt; $this-&gt;session-&gt;userdata('logged') ));
      }
    } else {
      $this-&gt;response(array(404 =&gt; 'missing parameter'));
    }
  }
  </code></pre>
  
  <p>it also has an array init. and the json response would like this below:</p>
  
  <pre><code>{
  "success": {
  "username": "johndoe123",
  "email": "myemail@gmail.com",
  "uniqueID": "1q2w3e4r5t6y",
  "userid": "97",
  "session_id": "1bbfdj07as68bvp3ctrboj8gs7"
  }
  }
  </code></pre>
  
  <p>the question is, how i to catch the session id that is store in client apps? </p>
  
  <p>so, when they are trying to get some information like news, or their profile. The client apps send me back the session id.</p>
  
  <p>I presume that session id has array data just like when they are try to login.
  so maybe i will get the array, array value will be the condition to get the news or profile. </p>
  
  <p>CMIIW</p>