• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make xmlrpc server work

#4
(03-08-2016, 05:31 PM)skunkbad Wrote: This works for me:

Client:

Now I'm getting error xml. Error not well formed invalid token at line 1
PHP Code:
<?php if( ! defined('BASEPATH') ) exit('No direct script access allowed');

class 
Xmlrpc_client extends CI_Controller{
    
    public 
function __construct()
    {
        parent::__construct();
    }

    // -----------------------------------------------------------------------

    /**
     * undocumented method
     */
    public function index()
    {
        $this->load->helper('url');
        $server_url site_url('xmlrpc_server'); /* I changed this */

        $this->load->library('xmlrpc');

        $this->xmlrpc->server($server_url80);
        $this->xmlrpc->method('Greetings');

        $request = array('How is it going?');
        $this->xmlrpc->request$request );

        if( ! $this->xmlrpc->send_request() )
        {
            echo $this->xmlrpc->display_error();
        }
        else
        
{
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
    }
    
    
// -----------------------------------------------------------------------
}

/* End of file Xmlrpc_client.php */
/* Location: /application/controllers/Xmlrpc_client.php */ 



Server:


PHP Code:
<?php if( ! defined('BASEPATH') ) exit('No direct script access allowed');

class 
Xmlrpc_server extends CI_Controller{
    
    public 
function __construct()
    {
        parent::__construct();
    }

    // -----------------------------------------------------------------------

    /**
     * undocumented method
     */
    public function index()
    {
        $this->load->library('xmlrpc');
        $this->load->library('xmlrpcs');

        $config['functions']['Greetings'] = array(
            'function' => 'Xmlrpc_server.process'
        );

        $config['object'] = $this;
        $this->xmlrpcs->initialize($config);
        $this->xmlrpcs->serve();
    }

    /**
     * undocumented method
     */
    public function process$request )
    {
        $parameters $request->output_parameters();

        $response = array(
            array(
                'you_said'  => $parameters[0],
                'i_respond' => 'Not bad at all.'
            ),
            'struct'
        );

        return $this->xmlrpc->send_response$response );
    }
    
    
// -----------------------------------------------------------------------
}

/* End of file Xmlrpc_server.php */
/* Location: /application/controllers/Xmlrpc_server.php */ 
Reply


Messages In This Thread
How to make xmlrpc server work - by littlefeather - 03-08-2016, 01:43 PM
RE: How to make xmlrpc server work - by ciadmin - 03-08-2016, 05:06 PM
RE: How to make xmlrpc server work - by skunkbad - 03-08-2016, 05:31 PM
RE: How to make xmlrpc server work - by littlefeather - 03-08-2016, 10:47 PM
RE: How to make xmlrpc server work - by ciadmin - 03-08-2016, 10:53 PM
RE: How to make xmlrpc server work - by skunkbad - 03-09-2016, 10:01 AM
RE: How to make xmlrpc server work - by skunkbad - 03-09-2016, 11:16 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.