[eluser]Tobz[/eluser]
Hi ya,
Im playing around with xml-rpc for the first time and I'm getting this error:
Top level XML-RPC element is missing
I now pretty much just copy/pasted the example code from the user guide, all I've changed is the server's controller and method names.
server:
Code:
class Update extends Controller {
function Update() {
parent::Controller();
}
function index() {
$this->load->library('xmlrpc');
$this->load->library('xmlrpcs');
$config['functions']['check'] = array ('function'=>'Update.check');
$this->xmlrpcs->initialize($config);
$this->xmlrpcs->serve();
}
function check($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);
}
}
and the client function:
Code:
function checkVersion() {
$this->load->library('xmlrpc');
$server_url = site_url('update');
$request = array('How is it going?');
$this->xmlrpc->server($server_url, 80);
$this->xmlrpc->method('check');
$this->xmlrpc->timeout(6);
$this->xmlrpc->request($request);
if (!$this->xmlrpc->send_request()) {
$output = $this->xmlrpc->display_error();
}
else {
$output = '<pre>';
$output .= print_r($this->xmlrpc->display_response(), true);
$output .= '</pre>';
}
return $output;
}
anyone see whats wrong here?
Thanks