I am trying to install the CodeIgniter RESTClient and RESTServer libraries for my solution. ( philsturgeon-codeigniter-restclient and chriskacerguis-codeigniter-restserver ).
I managed to start and start the remaining server, but I am encountering problems with the rest of the client.
Here are the steps I took when I am now:
- Copy the Rest.php file (downloaded from GitHub) and place it in the library folder
- Download Curl library and put it in libraries
- Changed the code in Rest.php to uncomment
$this->_ci->load->library('curl'); (if I hover over the use of the curl library in this file, I get the following message):
Field 'curl' not found in CI_Controller
I am creating a new controller called "Restclient" to test my API. In this controller, I created the following method:
function rest_client_example($id) { $this->load->library('rest', array( 'server' => 'localhost/codeigniter/api/users/' )); $user = $this->rest->get('volunteer', array('id' => $id), 'json'); var_dump($user); }
Looking at http: // localhost / codeigniter / api / restclient / rest_client_example / 25 then gives me
D:\wamp\www\codeigniter\application\controllers\api\Restclient.php:36:null
When executing the following code instead of the above, I get the correct result:
$this->load->library('curl'); $t = $this->curl->simple_get('api/users/volunteer', array('id'=>$id)); var_dump($t);
So, I know that curl works.
I assume that I am doing something wrong with loading the curl library?
source share