[eluser]SOVEREIGN[/eluser]
I've been testing the XML-RPC CodeIgniter class, it's pretty good, buy i don't
have any idea of how the parse the response i get from the webservice server.
I'm using the sample code given in the documentation to create server and client:
Client:
Code:
// The Server
public function xml_server() {
$this->load->library(');
$this->load->library(');
$config['functions']['] = array('function' => 'Welcome.echo_back);
$config['object'] = $this;
$this->xmlrpc->initialize($config);
$this->xmlrpc->serve();
}
// The Client
public function xml_client() {
$this->load->library(');
$this->xmlrpc->server('http://localhost/scripts/ci_rest/client/index.php/welcome/xml_server/', 80);
$this->xmlrpc->method(');
$this->xmlrpc->set_debug(TRUE);
$request = array('Message from Sov', 'Hi dude');
$this->xmlrpc->request($request);
if ( ! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
}
else
{
echo '<hr>';
echo '<pre>';
print_r($this->xmlrpc->display_response());
echo '</pre>';
}
}
// The XML Response Function
public function echo_back($request) {
$parameters = $request->output_parameters();
$response = array(
array(
'You sent to me:' => $parameters['0'],
'And: ' => $parameters['1']),
'struct');
return $this->xmlrpc->send_response($response);
}
With the above example, it shows the response received from the server, buy i would like to know how to store the response in a array or some variables.
The XML-RPC client print this to the browser:
Array
(
[you_said] => Hi dude?
[i_respond] => Hi there friend.
)
How do i store that values in a variable?
I tried like this:
Code:
$r = $this->xmlrpc->display_response();
print_r($r);
$d = xmlrpc_decode($r['[you_said]']);
print_r($d);
But doesn't works.
Is that possible? Sorry if it's a newbie question, but im new to this protocol.