python -> php via xml-rpc

my idea to comunicate a gnome applet with IILIAS open source is quite simple. Let’s see:

First, we have to do an xml-rpc server with PHP. Think that the incutio library is the easier. Why? ok, this is the server:

*php_tag*

include('IXR_Library.inc.php');

/* Functions defining the behaviour of the server */

function getTime($args) {
return date('H:i:s');
}

function helloClient($args) {
return("hello client");
}

/* Create the server and map the XML-RPC method names to the relevant functions */

$server = new IXR_Server(array(
'test.getTime' => 'getTime',
'test.helloClient' => 'helloClient'
));

*end_php_tag*


Ok, seems simple, uh? Now let’s see from the python interpreter:

>>> import xmlrpclib
>>> j = xmlrpclib.Server('http://tad1.ugr.es/xmlrpc/server.php')
>>> j.system.listMethods()
['system.multicall', 'system.listMethods', 'system.getCapabilities', 'test.helloClient', 'test.getTime']
>>> >>> j.test.getTime()
'01:51:55'

And that’s all folks!!!!

look at: jargon file with python + php

7 comentarios en “python -> php via xml-rpc

  1. Hope begins in the dark, the stubborn hope that if you just show up and try to do the right thing, the dawn will come. You wait and watch and work: you don’t give up.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s