Welcome Guest, Not a member yet? Register   Sign In

Excuse the maybe obvious question.

Can this lib be used to make a request via REST to an outside web service (say upcoming.org) and then parse the xml result into a useable object-> to use within the CI app?

Sorry, but web services don't use a unified protocol for that, so I'm afraid you will have to write your own functions for that. This library is for exposing REST, not making requests

Thank you very much for the contribution, it's working great for me and I just wanted to notate two simple mods I made to the library file and a few things I found out.

First, my rest service sits in a folder under controllers called "services", that way i can keep rest, post & xml-rpc all in one place. However i was having issues simply naming the class "rest" so i use it as "restful" and it works fine Wink Also since the class is being called one path location deeper i modified $i = 2 rather than $i = 1. This jumps the parse one folder deeper.

Lastly I noticed that the class would throw an error when trying to assign an empty index to the segmentArray. so I added the following conditional (also including my index bump from 1 -> 2 for the path issue):

//starting at line 18
        $i = 2;
         while($i < count($test))
            if($test[$i] != ""){
                $array[strtolower($test[$i])] = strtolower($test[$i + 1]);
            $i = $i + 2;

Now this produces a cleaner error free set of arrays in the $this->rest object and everything works awesome.

I will have to add this to the project, but I havent been doin much development on it, but I will try and add the code, thanks for your patch ^_^

somethign else i found:

This an old thread, but the first hit on goodle for CodeIgniter REST. So here is my approach to REST with codeigniter, in case anyone is interested.



First of all, I would like to thank you for this

Is it possible to call the API (http://domain-name.com/controller/name_o...ction_name) with an XML file as an argument to the calling function (function_name) ?

What I am trying to do is, to call the function, function_name, with an XML file. And function, function_name, will parse the XML, process & returns the value.

Thank You.


How can I create URL to call the Controller Function, if my controller pages is in Sub Folder ?


So I followed the directions set forth on how to implement Rest.php in the codeigniter library. I would like to test this REST implementation out. I am assuming that the Api controller example is a working example. I keep on receiving this PHP Error:

A PHP Error was encountered

Severity: Notice

Message: Undefined index: function

Filename: libraries/Rest.php

Line Number: 81

Could someone point me in the right direction?

Dude thanks so much for this.

Theme © iAndrew 2016 - Forum software by © MyBB