Welcome Guest, Not a member yet? Register   Sign In
Issue with REST.php (SOLVED)
#1

[eluser]Julian_Omaha[/eluser]
I am attempting to connect to an existing REST api to an application: (code)

$this->load->library('rest', array(
'server' => 'http://www dot domain dot com/webservices/example_api/',
'http_user' => 'admin',
'http_pass' => '1234',
'http_auth' => 'basic' // or 'digest'
));

$user = $this->rest->get('user', array('emp_id' => '1'), 'json');

echo $user->empfirstname;
This seems to be pretty straight forward. I have placed the Rest.php in the applications/libraries/ folder.

I am getting the following? Anyone have a suggestion?

A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$rest
Filename: views/welcome_message.php
Line Number: 69
Fatal error: Call to a member function get() on a non-object in C:\xampp\htdocs\restex\application\views\welcome_message.php on line 69

FIX
Dumb mistake. Attempted to load library in view, not the controller.




Theme © iAndrew 2016 - Forum software by © MyBB