To create a new post, all we need to do is perform a new POST request to the URL of the Post Controller (or server if we were doing this on a real project). We also need to send the new blog post across. We do this by creating a new serialized array with three keys: author, title, and content. Then we simply fill the array keys with the blog post author, post title and the post content, and we're all set.
Take special care when going over the line of code where we perform the request. The first parameter is the URL of the server. The second parameter is the type of request that we want to make. This is optional and defaults to GET. The final parameter is the data that you want to send across the request. This is also optional.
<?php class Client extends Controller { function Client() { parent::Controller(); $this->load->library('rest'); } function index() { $data = array( 'author' => 'blog post author', 'title' => ...