Welcome Guest, Not a member yet? Register   Sign In
Creating my XML-RPC server
#1

[eluser]a77icu5[/eluser]
Code:
<?php
class Server extends Controller {

    public function __construct() {
        parent::Controller();
        $this->load->model('my_model');
    }
    
    public function index() {        
        $config['functions']['demo'] = array('function' => 'Server.process');
        $this->xmlrpcs->initialize($config);
        $this->xmlrpcs->serve();
    }
    
    
    public function process($request) {
        $parameters = $request->output_parameters();
        $data = $this->my_model->getAll();
        if (sizeof($data) == 0) {
            return $this->xmlrpc->send_error_message('123', 'Requested data not available');
        } else {
            foreach($data as $item) {
            $response[] = array(array('id' => $item->id,
                'name'    =>    xml_convert($item->name),
                'city'    =>    $item->city,
                'status'=>    $item->status), 'struct');
            }
            return $this->xmlrpc->send_response($response);
        }
    }
}
?>

Error: The XML data receieved was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.

I think is because $response array had wrong format, somebody help me !!!


Messages In This Thread
Creating my XML-RPC server - by El Forum - 12-03-2010, 12:54 PM
Creating my XML-RPC server - by El Forum - 12-03-2010, 04:49 PM
Creating my XML-RPC server - by El Forum - 12-03-2010, 09:10 PM
Creating my XML-RPC server - by El Forum - 01-20-2011, 12:05 PM
Creating my XML-RPC server - by El Forum - 01-20-2011, 01:28 PM
Creating my XML-RPC server - by El Forum - 07-20-2011, 04:41 AM
Creating my XML-RPC server - by El Forum - 07-20-2011, 07:45 PM
Creating my XML-RPC server - by El Forum - 07-20-2011, 11:52 PM
Creating my XML-RPC server - by El Forum - 07-21-2011, 06:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB