Search code examples
phptracxml-rpc

Using PHP to manage(add/edit/update) Trac via XML-RPC - Sample code/Tutorial?


I know there exists xml-rpc plugin for Trac (http://trac-hacks.org/wiki/XmlRpcPlugin), but I was wondering if anybody knows any example/tutorial for using xml-rpc PHP client to update Trac infos.

Thanks


Solution

  • The last time I used XmlRpc, I used Zend_XmlRpc_Client. Here is one of the examples translated from Python to PHP (using Zend_XmlRpc_Client):

    The trac runs on localhost:

    <?php
    require_once 'Zend/XmlRpc/Client.php';
    
    $client = new Zend_XmlRpc_Client("http://user:pass@localhost/login/xmlrpc");
    $trac   = $client->getProxy();
    echo $trac->getPage('WikiStart');
    echo $trac->getPageHTML('WikiStart');
    

    Does that get you started?