User Tools

Site Tools


code:xmlrpc-php

How to use the XML-RPC interface within PHP

It should be relatively straight forward. Just:

svn co https://rts-2.svn.sf.net/svnroot/rts-2/trunk/rts2phplib rts2phplib

You most probably will need PHP XML-RPC library. Debian package is called php5-xmlrpc.

Of course you will need rts2-xmlrpcd running, as well as some web-server with PHP installed.

Then you can see either example included in rts2phplib/rts2.php, or use code provided bellow to start with the library:

 // make sure that file rts2phplib/rts2.inc exists in your PHP script directory
 include('rts2phplib/rts2.inc');
 // create rc - rts2 client - object
 $rc = new rts2xmlrpc('localhost', 8889);
 // print some values..
 print '<hr/>Value of T0.OBJ:' . $rc->valueOf('T0', 'OBJ') . '<br/>';
 print 'Value of T0.infotime:' . $rc->valueOf('T0', 'infotime') . '<br/>';

Available functions

devices()

devices() call returns array which contains name of all devices in the system.

valueOf()

Takes in two parameters - name of device and name of value. Return string representation of the value.

code/xmlrpc-php.txt · Last modified: 2009/02/23 00:00 (external edit)