Wiki Page
Getting new items via PHP and XMLRPC
- Install phpxmlrpc ( http://phpxmlrpc.sourceforge.net/ )
- Use the following code on your page:
<?php
include('includes/xmlrpc/lib/xmlrpc.inc');
$admin = "siteadmin";
$password = "secret";
$numberofitems = "8";
$xmlrpc_internalencoding = 'UTF-8';
$client = new
xmlrpc_client("http://$admin:$password@yoursite/stacker");
$client->return_type = 'phpvals';
$message = new xmlrpcmsg("getRecentUpdates",array(new xmlrpcval($numberofitems, "int")));
$resp = $client->send($message);
$x = 0;
foreach($resp->val['itemlist'] as $result){
// Icons
$iconmessage = new xmlrpcmsg("getTypeInfo", array(new xmlrpcval($result['portal_type'], "string")));
$iconresp = $client->send($iconmessage);
$iconurl = $iconresp->val['typeiconurl'];
echo "<img src='" . $iconurl . "'>";
$zeit = $result['modified'];
$titel = $result['title'];
$ersteller = $result['creator'];
echo " " . $titel . "<br />";
echo "<h5><b>" . $ersteller . " um " . $zeit . "h</b></h5><br />";
$x++;
}
?>
How to use PHP and XMLRPC to list a configurable number of new cyn.in items in your portal.

Blog
Status Log
There's also a debug mode in php xmlrpc, from what I remember - we did that stuff quite a while back when we were doing auth integration for cynapse.com. It will show you what the call actually returned from Cyn.in.
We're using an xmlrpc call at drupal to call this Cyn.in community you're commenting on, to authenticate you so it works, let me assure you. :)
Now, to figure out why you're not getting results -> Maybe the user you're querying with doesn't actually *have* any items to see? It all depends, on your scenario and your script. If you want to try a little python, you can start off an interactive python prompt to query the Cyn.in user in a few lines and validate your logic in a parallel way, like so:
Login, get and set status message, looks like this:
dhiraj@dhiraj:~$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xmlrpclib import ServerProxy
>>> ser = ServerProxy("http://siteadmin:secret@SITEHOSTNAME/cynin/stacker")
>>> ser.sayhello()
'Hello'
>>> ser.getStatusMessage()
''
>>> ser.setStatusMessage('Hello World')
'Hello World'
>>> ser.getStatusMessage()
'Hello World'
Other API functions can be tested similarly.
Solving the first challange, next came up:
Debug info::Sorry, the requested resource does not exist. Check the URL and try again. Resource: http://localhost:8080/cynin/VirtualHostRoot
Seems, that rewrite rules provided in ISO installation (and working fine for cyn.in) causes an error in xmlprc call. I've tried IP address as well as domain name as server address. Any hint for me?
I'm definitely sure about the virtualhostmonster rewriting the URLs safely for Cyn.in XMLRPC as well as for main site - it's rewritten in exactly the same way and the default works. There is normally no separate rewrite rule for the XMLRPC API.
Example: If you call your site at http://my.site.com, then your xmlrpc endpoint URL will be http://my.site.com/stacker <- replace end-point depending upon use case. In most cases above endpoint is to be used.
There are 2 more endpoints, 1 for anonymous calls (forgot password) and 1 for admin-only calls (create user).
If rewriting is not working or something else is wrong, you can safely communicate with Cyn.in instance directly, for xml-rpc.
Example:
If your Cyn.in site runs at port 8080, on IP: 192.168.1.106, then you can call same stacker API above by using URL
http://user:password@192.168.1.106:8080/cynin/stacker
Note the positing of the words cynin and stacker in above URL. cynin is the site object name and stacker is the API endpoint.
It is mandatory to specify API endpoint, this is the basis of the security interface.
Now I'm investigating PHP implementation for causing the error because parameter, server address, path etc.are same but error is returned by Zope using xmlrpc.inc for PHP.
What are you using?
=====Pasting from xmlrpc.inc======
// by Edd Dumbill (C) 1999-2002
// <edd@usefulinc.com>
// $Id: xmlrpc.inc,v 1.174 2009/03/16 19:36:38 ggiunta Exp $
// Copyright (c) 1999,2000,2002 Edd Dumbill.