title: How to send POST request to Phil Sturgeon's CodeIgniter RestServer
body: <p>I'm new to CodeIgniter. I'm using Phil Sturgeon's RestServer and RestClient. I've been trying to make a POST request in my CodeIgniter RestClient controller to update data in my CodeIgniter RestServer, but it never updates data in my database. I think my POST request is not right.</p>
  
  <p>Here is my RestClient POST request in controller:</p>
  
  <pre><code>$result = $this-&gt;rest-&gt;post('newscontroller/news/format/json', 
            array('news_id' =&gt; $news_id,
                  'news_title' =&gt; $news_title,
                  'news_category' =&gt; $news_category ),
                  'json'); 
  
  if(isset($result-&gt;status) &amp;&amp; $result-&gt;status == 'success')  
  {  
          $data['message'] ='News has been updated.';  
          $this-&gt;load-&gt;view('otherpageview',$data);
  }     
  else  
  {  
          $data['message'] ='Something has gone wrong';  
          $this-&gt;load-&gt;view('otherpageview',$data);
  } 
  </code></pre>
  
  <p>It seems that <strong>$result</strong> doesn't get any value, because I did echo the <strong>$result->status</strong> and it has nothing to display. And I've also have this in this controller's constructor :</p>
  
  <pre><code>// Load the rest client spark
  $this-&gt;load-&gt;spark('restclient/2.1.0');
  
  // Load the library
  $this-&gt;load-&gt;library('rest');
  
  // Run some setup
  $this-&gt;rest-&gt;initialize(array('server' =&gt; 'http://api.therestserver.com/index.php/'));
  </code></pre>
  
  <p>And in the RestServer's controller, which is <strong>newscontroller</strong>, has this method :</p>
  
  <pre><code>function news_post()
  {
      $news=array(
          'news_id' =&gt; $this-&gt;post('news_id'),
          'news_title' =&gt; $this-&gt;post('news_title'),
          'news_category' =&gt; $this-&gt;post('news_category') );
  
      $result = $this-&gt;News_model-&gt;UpdateNews($news);  
  
      if($result === FALSE)  
      {  
          $this-&gt;response(array('status' =&gt; 'failed'));  
      }  
      else  
      {  
          $this-&gt;response(array('status' =&gt; 'success'));  
      }
  }
  </code></pre>
  
  <p>With the <strong>News_model</strong> :</p>
  
  <pre><code>public function UpdateNews($news)
  {
      $this-&gt;db-&gt;where('news_id',$news-&gt;news_id);
      $this-&gt;db-&gt;update('news',$news);        
  }
  </code></pre>
  
  <p>I just don't know where I'm doing wrong, because I still don't understand how the POST request and method work. I've read through the tutorial in Nettuts and search about this, but still.. maybe because of my bad English reading-writing. I hope someone can help me out, any help would be appreciated. Thanks a TON! :)</p>