On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Just my 2 cents here for what its worth, it may be better to create a generic/general purpose set of classes to wrap XMLRPC functions interfaced to MODx, i.e a $modx->xmlrpc object, this gives a base class from which people can instantiate specific interfaces e.g one for blogging, one for e-mail/calendar colaboration etc.

    Basic security/logging/metrication can be built into the base class allowing individual users to worry only about checking the parameters of their specific interface.

    This is, as always, much easier said than done but may save time and pain in the long run.
      Use MODx, or the cat gets it!
    • shamblett, this is exactly why I am asking for help. I am not a php dev. I am a cut-n-paste programmer. I have no problem building simple snippets but a generic class for modx is not something within my skillset.

      My short term goal is to enable remote blog/document editing but if there is a better way, please help me out.

      OpenGeek has an XMLRPC built into modx Revolution and I’m sure we could use much of it but I don’t even know where to begin.

        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
      • OK, didnt know about the implementation in revolution, I’ll get the latest code base here and have a look at this, it may be possible to utilize some of this if I can detach it from the XPDO model revolution uses. I cant promise anything till I look but I’ll try and do this at weekend say. I’ll get back to you on this.
          Use MODx, or the cat gets it!
        • From Jason (OpenGeek) in another thread asking if this was possible:
          XML-RPC (and JSON-RPC) are already integrated into Revolution. I suggest looking at the libraries there for inspiration (core/model/modx/xmlrpc/ and core/model/modx/jsonrpc/), but creating a snippet is absolutely the best way to integrate this into 0.9.6.x. A MODx Document should serve as an XML-RPC server IMHO. In Revolution, there will be custom mechanisms for easily creating custom RPC server Response classes (in Revolution there is a class representing a Request and a Response), and extending them to be as simple or complex as you need. But in 0.9.6.x, you’ll need to do all the heavy lifting in a snippet (and/or possibly a plugin).

          Thanks shamblett. Maybe me and my little mind will look at this also and we can build out a generic wrapper class for it for 096/Evolution.

            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
          • I just remembered that Dr. Scotty Delicious was working on something similar, but for Mac only. Maybe he could share his thoughts on how to get an app to post over to MODx, since I believe he actually had this working.


            Good luck! (I’m not a programmer, either)
            • Ok smashing red, I’ve done a bit of experimentation here, I’ve lifted the XMLRPC client and server code from revolution, this was fairly simple as its just a third party library with a MODx wrapper around it. I’ve also obtained a Blogger API library that wraps the XMLRPC Client and implements the Blogger API. This is a common blogging API that allows you to add blogs, read blogs, get blog info etc.

              I’ve put these in external php file under /assets/snippets, called from this snippet inside MODx :-
              global $modx;
              // Get the Blogger API
              $modx_xmlrpc_path = $modx->config['base_path'] . "assets/snippets/xmlrpc/";
              // Get the supported methods
              $info_array = blogger_getSupportedMethods();
              echo "<p>The supported XMLRPC functions on the Wordpress server are :- </p></br>";
              foreach ($info_array as $method)
                  echo "<p><strong>$method</strong></p>";
              // Post a blog, get a blog, get user info etc. etc.

              OK, this lists the supportd XMLRPC methods on the wordpress server, go here to see it in action http://bitez.hobby-site.com/index.php?id=84 or just navigate to the XMLRPC test page under the Software section of my site.

              You can do whatever with this now, add blogs, read blogs, or anything that’s supported

              Is this what you were after, i.e you can type some text into a MODx page, press submit, and it turns up in the blog of your choice, I’ve used Wordpress here for the demo but you can use any XMLRPC server you wish, not just for blogs either.

              Coming the other way i.e MODx acting as a server is a bit harder, the security concerns already raised on this thread are very valid here, we dont want to open an attack vector into peoples installations. This would allow people using a blog client to ’publish’ to a MODx site. You would have to take say the server side implementation of the blogger api and modxify it to use your db tables etc. Authentication would also be needed, can be done but lots of work.

                Use MODx, or the cat gets it!
              • shamblett,

                Thanks for the effort.

                I was, in fact looking to build out the ability to create, edit, delete modx documents using one of the common blogging apis. I am well aware of the issues of security and it certainly needs to be addressed.

                First: We need to have a login required.
                Second: It makes sense to either create a special user with limited permissions to use the account.
                Third: It makes sense to limit the XMLRPC to limited parts of the document tree.
                Fourth. It makes sense to limit the access to modx functions via the XMLRPC class for editing posts etc.

                Any time there is script access to the CRUD mechanism security is important. XSS/MySQL injections etc.

                Because there risks, you take care to block everything and allow a tiny accesspoint and then make sure that accesspoint is controlled and further limited.

                I’ll look at what you have done and see if I can make it work this week.


                  Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
                • Just had a look at the Wordpress XMLRPC server code, this extends the IXR server that comes with Wordpress so you may be better using this as a starting point rather than the xmlrpcs code that revolution uses unless you want to develop your own MODx server.

                  All you would need to do is remove the methods you dont need, i.e. trim it down a lot and update the remaining methods to login and create/delete MODx documents using the MODx API, shouldn’t be too difficult.
                    Use MODx, or the cat gets it!