CodeIgniter Forums
sample xml-rpc code - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: sample xml-rpc code (/showthread.php?tid=8651)



sample xml-rpc code - El Forum - 05-26-2008

[eluser]Unknown[/eluser]
i am new to code igniter, i could not take off using code-igniter's xml-rpc library.. does anyone have a quick and dirty sample of xml-rpc serving and requesting just a simple write to a text file so i could understand it?

in your user guide i could not find the method new_entry... where is it written? in another controller? please help me..
$config['functions]['new_post'] = array('function' => 'My_blog.new_entry'),


sample xml-rpc code - El Forum - 05-26-2008

[eluser]HdotNET[/eluser]
the manual only covers a simple call / response example with actual code. the rest is metaphorical.


sample xml-rpc code - El Forum - 05-26-2008

[eluser]gtech[/eluser]
if you scroll down the page a bit to

Creating Your Own Client and Server

you will find a working example of a client and server, is that what you are after?


sample xml-rpc code - El Forum - 05-26-2008

[eluser]Unknown[/eluser]
yes i tried the samples. i just dont know where to put the class that it calls.. will it be a new controller? how can i shield it from view from not a xml-rpc call?


sample xml-rpc code - El Forum - 05-26-2008

[eluser]gtech[/eluser]
OK I assume you have the client and server example working

in the server code you can map XMLRPC calls to any function in any controller,
Code:
$config['functions']['Greetings'] = array('function' => 'Xmlrpc_server.process');
$config['functions']['Another'] = array('function' => 'Another_controller.functionname');
the example above uses Xmlrpc_server.process ... Xmlrpc_server being the controller name and process being the function.

if you want to shield the function from the webbrowser you can use an underscore before the function name

Xmlrpc_server._process

or

Another_controller._anotherfunction

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

    function _process($request)
    {
      //this function is only callable from XMLRPC interface.
......
?>

does that help?