I am trying to install the CodeIgniter RESTClient and RESTServer libraries for my solution. (philsturgeon-codeigniter-restclient and chriskacerguis-codeigniter-restserver ).
I managed to get the rest server up and running, but I am encountering issues with the rest client.
These are the steps I did to come where I am now:
$this->_ci->load->library('curl');
(if I hover over the usages of the curl library in this file I get the following message): Field 'curl' not found in CI_Controller
I create 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);
}
Browsing to 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 do get a correct result:
$this->load->library('curl');
$t = $this->curl->simple_get('api/users/volunteer', array('id'=>$id));
var_dump($t);
So I do know that the curl is working.
My guess is that I am doing something wrong with the loading of the curl library?
I know your question is specific to the Libraries mentioned here. Have you tried anything else? I've had really good success with guzzle http
https://github.com/guzzle/guzzle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With