Welcome Guest, Not a member yet? Register   Sign In
using my library method in XML-RPC
#6

[eluser]Elliot Haughin[/eluser]
I think there is still an issue loading methods from another controller.
I get 'not valid method' error using this code:

Code:
<?php
    
    class Api extends Controller {
    
        function Api()
        {
            parent::Controller();
            
            log_message('debug', 'Api received method');
        }
        
        function index()
        {
            $this->load->library('xmlrpc');
            $this->load->library('xmlrpcs');
            $this->load->library('server');

            $config['functions']['Posts.getLatest']     = array('function' => 'Posts.getLatest');
            $config['functions']['Posts.getSingle']     = array('function' => 'Posts.getSingle');
            
            $config['object'] = $this;
            
            $this->xmlrpcs->initialize($config);
            
            $this->xmlrpcs->serve();
        }
    }
    
?>

and controllers/posts.php:

Code:
<?php
    
    class Posts extends Controller {

        function Posts()
        {
            parent::Controller();
            
            $this->load->library('xmlrpc');
            $this->load->library('xmlrpcs');
            $this->load->library('server');
        }
        
        function getLatest($request)
        {
            $params = $this->server->prep_request($request);
            
            if    (!empty($params[0]))
            {
                $limit = $params[0];
            }
            else
            {
                $limit = 'none';
            }
            
            $response = array('you want posts! limit '.$limit, 'string');
            
            return $this->server->send_response($response);
        }
    }

?>


Messages In This Thread
using my library method in XML-RPC - by El Forum - 04-15-2008, 01:33 AM
using my library method in XML-RPC - by El Forum - 04-15-2008, 02:37 AM
using my library method in XML-RPC - by El Forum - 04-15-2008, 04:13 AM
using my library method in XML-RPC - by El Forum - 04-15-2008, 08:29 AM
using my library method in XML-RPC - by El Forum - 05-08-2008, 12:42 PM
using my library method in XML-RPC - by El Forum - 05-17-2008, 07:54 AM
using my library method in XML-RPC - by El Forum - 05-17-2008, 08:03 AM
using my library method in XML-RPC - by El Forum - 05-22-2008, 03:45 PM
using my library method in XML-RPC - by El Forum - 05-22-2008, 04:48 PM
using my library method in XML-RPC - by El Forum - 05-22-2008, 05:02 PM
using my library method in XML-RPC - by El Forum - 05-22-2008, 05:14 PM
using my library method in XML-RPC - by El Forum - 07-15-2008, 03:25 AM
using my library method in XML-RPC - by El Forum - 07-15-2008, 08:33 AM
using my library method in XML-RPC - by El Forum - 07-15-2008, 08:55 PM
using my library method in XML-RPC - by El Forum - 07-16-2008, 06:19 AM
using my library method in XML-RPC - by El Forum - 07-16-2008, 07:11 AM
using my library method in XML-RPC - by El Forum - 07-16-2008, 08:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB