[eluser]Unknown[/eluser]
Trying to run Codeigniter User Guide XML RPC Sample Code.
This is the code
xmlrpc_client.php
Code:
<?php
class Xmlrpc_client extends CI_Controller {
function index()
{
$this->load->helper('url');
$server_url = site_url('xmlrpc_server');
$this->load->library('xmlrpc');
$this->xmlrpc->server($server_url, 80);
$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>';
}
}}?>
xmlrpc_server.php
Code:
<?php
class Xmlrpc_server extends CI_Controller {
function index()
{
$this->load->library('xmlrpc');
$this->load->library('xmlrpcs');
$config['functions']['Greetings'] = array('function' => 'Xmlrpc_server.process');
$this->xmlrpcs->initialize($config);
$this->xmlrpcs->serve();
}
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);
}}?>
After this, i ran the url like this.
remoteserver's ip/xmlrpc_client
(i deleted my index.php using .htaccess, dont need to type it)
the result is like this,
Did not receive a '200 OK' response from remote server. (HTTP/1.1 404 Not Found)
If i run the server code, remoteserver's ip/xmlrpc_server it says like this.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
Which means,
$this->xmlrpc->send_request()
this request have been failed
and echoed
echo $this->xmlrpc->display_error();
Any idea what is the problem is?
Oh, i have another question.
Do i have to install xmlrpc php extension before i use this codeigniter xmlrpc class?