Accessing the REST Server Using the Curl Library

Home

Tests Home

Code Example:

        $user_id = 1;

        $this->load->helper('url');
        $this->load->library('curl');

        $this->curl->create(site_url('api/example/users/id/'.$user_id.'/format/json'));

        // Optional, delete this line if your API is open.
        $username = 'admin';
        $password = '1234';
        $this->curl->http_login($username, $password);

        $result = $this->curl->get()->execute();

Result:

bool(false)