<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0">

    <channel>

        <title>Getting new items via PHP and XMLRPC</title>
        <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc</link>
        <description>How to use PHP and XMLRPC to list a configurable number of new cyn.in items in your portal.</description>

        <generator>basesyndication</generator>

        <image>
            <title>Getting new items via PHP and XMLRPC</title>
            <url>http://www.cynapse.com/community/logo.jpg</url>
            <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc</link>
        </image>

        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1275292507</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1275292507</link>
                <description>We are using this doing xmlrpc from php. This does not seem to be causing any problems, although I can't off-hand say that we have in fact checked it for case sensitivity problems.&lt;br /&gt;&lt;br /&gt;What are you using?&lt;br /&gt;&lt;br /&gt;=====Pasting from xmlrpc.inc======&lt;br /&gt;// by Edd Dumbill (C) 1999-2002&lt;br /&gt;// &amp;lt;&lt;a href="&amp;#0109;ailto&amp;#0058;edd&amp;#0064;usefulinc.com"&gt;edd&amp;#0064;usefulinc.com&lt;/a&gt;&amp;gt;&lt;br /&gt;// $Id: xmlrpc.inc,v 1.174 2009/03/16 19:36:38 ggiunta Exp $&lt;br /&gt;&lt;br /&gt;// Copyright (c) 1999,2000,2002 Edd Dumbill.</description>
                <author>Dhiraj Gupta</author>


                <pubDate>Mon, 31 May 2010 07:55:07 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title>Getting new items via PHP and XMLRPC</title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc</link>
                <description>
&lt;ol start="1"&gt;&lt;li&gt;Install phpxmlrpc ( &lt;a class="external-link" href="http://phpxmlrpc.sourceforge.net/"&gt;http://phpxmlrpc.sourceforge.net/&lt;/a&gt; )&lt;/li&gt;&lt;li&gt;Use the following code on your page:&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&amp;lt;?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-&amp;gt;return_type = 'phpvals';

$message = new xmlrpcmsg("getRecentUpdates",array(new xmlrpcval($numberofitems, "int")));
$resp = $client-&amp;gt;send($message);

$x = 0;
foreach($resp-&amp;gt;val['itemlist'] as $result){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Icons
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $iconmessage = new xmlrpcmsg("getTypeInfo", array(new xmlrpcval($result['portal_type'], "string")));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $iconresp = $client-&amp;gt;send($iconmessage);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $iconurl = $iconresp-&amp;gt;val['typeiconurl'];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "&amp;lt;img src='" . $iconurl . "'&amp;gt;";


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $zeit = $result['modified'];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $titel = $result['title'];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ersteller = $result['creator'];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo " " . $titel . "&amp;lt;br /&amp;gt;";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "&amp;lt;h5&amp;gt;&amp;lt;b&amp;gt;" . $ersteller . " um&amp;nbsp; " . $zeit . "h&amp;lt;/b&amp;gt;&amp;lt;/h5&amp;gt;&amp;lt;br /&amp;gt;";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $x++;
}
?&amp;gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
</description>
                <author>Matthias</author>

                
                    <category>php</category>
                
                
                    <category>howto</category>
                
                
                    <category>xmlrpc</category>
                

                <pubDate>Mon, 31 May 2010 07:55:07 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1275290998</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1275290998</link>
                <description>Seems that xmlrpc.inc will change all method names to lower before calling. I've found some comments on it and some source like strtolower(). If tried misspelling in Python wich causes similiar error message.</description>
                <author>Guido Kopkow</author>


                <pubDate>Mon, 31 May 2010 07:29:58 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1275079415</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1275079415</link>
                <description>Python example as described and access from outside works fine for tested methods. &lt;br /&gt;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. </description>
                <author>Guido Kopkow</author>


                <pubDate>Fri, 28 May 2010 20:43:36 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274994195</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274994195</link>
                <description>I will ask someone to checkout what version we're using for our auth module and update.&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;Example: If you call your site at &lt;a href="http://my.site.com" rel="nofollow"&gt;http://my.site.com&lt;/a&gt;, then your xmlrpc endpoint URL will be &lt;a href="http://my.site.com/stacker" rel="nofollow"&gt;http://my.site.com/stacker&lt;/a&gt;   &amp;lt;- replace end-point depending upon use case. In most cases above endpoint is to be used.&lt;br /&gt;There are 2 more endpoints, 1 for anonymous calls (forgot password) and 1 for admin-only calls (create user).&lt;br /&gt;&lt;br /&gt;If rewriting is not working or something else is wrong, you can safely communicate with Cyn.in instance directly, for xml-rpc.&lt;br /&gt;Example:&lt;br /&gt;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&lt;br /&gt;http://user:password@192.168.1.106:8080/cynin/stacker&lt;br /&gt;Note the positing of the words cynin and stacker in above URL. cynin is the site object name and stacker is the API endpoint.&lt;br /&gt;&lt;br /&gt;It is mandatory to specify API endpoint, this is the basis of the security interface.</description>
                <author>Dhiraj Gupta</author>


                <pubDate>Thu, 27 May 2010 21:03:15 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274993609</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274993609</link>
                <description>I have spend some time investigating in the issue. First of all, both versions of the xmlrpc.inc provide by link on top of the page didn't fit to php 5.2. I have made a change in beta version manually and now xmlrpc.inc is working. &lt;br /&gt;Solving the first challange, next came up:&lt;br /&gt;Debug info::Sorry, the requested resource does not exist. Check the URL and try again. Resource: &lt;a href="http://localhost:8080/cynin/VirtualHostRoot" rel="nofollow"&gt;http://localhost:8080/cynin/VirtualHostRoot&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;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?&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;</description>
                <author>Guido Kopkow</author>


                <pubDate>Thu, 27 May 2010 20:53:29 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274956742</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274956742</link>
                <description>So like that you can set the status message of the current user, in above example, the current Status message of the siteadmin user would be set to Hello World, and it would show up on the Cyn.in UI when somebody clicked on their avatar.&lt;br /&gt;&lt;br /&gt;Other API functions can be tested similarly.</description>
                <author>Dhiraj Gupta</author>


                <pubDate>Thu, 27 May 2010 10:39:02 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274956592</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274956592</link>
                <description>@guido: Hmm... try turning error logging on, in your php file, if it's not already on. When you say &amp;quot;doesn't deliver any result&amp;quot; you're checking the value of $resp, yes?&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;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. :)&lt;br /&gt;&lt;br /&gt;Now, to figure out why you're not getting results -&amp;gt; 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:&lt;br /&gt;&lt;br /&gt;Login, get and set status message, looks like this:&lt;br /&gt;&lt;br /&gt;dhiraj@dhiraj:~$ python&lt;br /&gt;Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) &lt;br /&gt;[GCC 4.3.3] on linux2&lt;br /&gt;Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; from xmlrpclib import ServerProxy&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; ser = ServerProxy(&amp;quot;http://siteadmin:secret@SITEHOSTNAME/cynin/stacker&amp;quot;)&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; ser.sayhello()&lt;br /&gt;'Hello'&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; ser.getStatusMessage()&lt;br /&gt;''&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; ser.setStatusMessage('Hello World')&lt;br /&gt;'Hello World'&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; ser.getStatusMessage()&lt;br /&gt;'Hello World'&lt;br /&gt;</description>
                <author>Dhiraj Gupta</author>


                <pubDate>Thu, 27 May 2010 10:36:33 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274955105</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274955105</link>
                <description>xmlrpcmsg doesn't deliver any result. Is there a log on server side? The desktop client is working fine, so I can exclude access probs.</description>
                <author>Guido Kopkow</author>


                <pubDate>Thu, 27 May 2010 10:11:46 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274898098</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274898098</link>
                <description>This code works for me in 3.1.3. What doesn't work? Any errors?</description>
                <author>Matthias</author>


                <pubDate>Wed, 26 May 2010 18:21:38 +0000</pubDate>

                
            </item>
        
        
            <item>
                <title></title>
                <guid>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274777880</guid>
                <link>http://www.cynapse.com/community/home/cyn.in-developers/getting-new-items-via-php-and-xmlrpc/view/#1274777880</link>
                <description>This example didn't work for me on 3.1.3. Are there any changes in the meantime?</description>
                <author>Guido Kopkow</author>


                <pubDate>Tue, 25 May 2010 08:58:00 +0000</pubDate>

                
            </item>
        

    </channel>
</rss>

