需要 WordPress XMLRPC 建议
我的任务是创建一个 API,用于从 Flash 应用程序和旧版 CMS(非 PHP)检索内容并将其添加到 Wordpress。我的计划是利用现有的默认 xmlrpc 端点,并通过创建一个挂钩到 xmlrpc_methods 的插件来添加任何附加功能。
另一位开发人员之前曾根据以下代码进行过尝试:
http://blog.5ubliminal.com/posts/remote-control-wordpress-blog-xmlrpc-api/
这段代码对我来说看起来很笨拙并且文档记录很差,我更喜欢使用这种方法:
http://kovshenin.com/archives/custom-xml-rpc-methods- in-wordpress/
如果任何在这方面有经验的人能够证实这一点,我将不胜感激:
- 当通过 XMLRPC 检索和发布数据时,我将能够区分 MU 安装中的单独博客
- 我将能够检索并发布到自定义字段
- 编写插件是可行的方法。
我们无法选择使用 Wordpress 3,因为它仍处于 Beta 阶段,而且我们面临着时间压力。
我将非常感谢任何意见/建议。
非常感谢,
I have been tasked with creating an API for retrieving and adding content to Wordpress from a flash application and legacy CMS (non-PHP). My plan is to utilise the existing default xmlrpc endpoint and add any additional functionality by creating a plugin which hooks into xmlrpc_methods.
A previous attempt had been made by another developer based on the following code:
http://blog.5ubliminal.com/posts/remote-control-wordpress-blog-xmlrpc-api/
This code looks unwieldy and poorly documented to me and my preference would be to use this approach:
http://kovshenin.com/archives/custom-xml-rpc-methods-in-wordpress/
I would be grateful if anyone with experience in this area could confirm that:
- I will be able to distinguish between separate blogs in an MU installation when both retrieving and posting data via XMLRPC
- I will be able to retrieve and post to custom fields
- writing a plugin is the way to go.
We do not have the option of using Wordpress 3 as it is still in Beta and we are under time pressure.
I would greatly appreciate appreciate any input / advice.
Many thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我之前使用过 WordPress 的 XMLRPC 系统(使用 WP-Hive 安装和多个独立的博客,类似于 WPMU 设置)。您使用的新方法肯定更简单且更容易实现(我第一次尝试了 5ubliminal 方法)。
您是否可以区分 MU 安装中的单独博客完全取决于您如何构建处理程序函数。您可以构建它来区分单独的博客,仅在特定博客上运行,或者将整个系统视为单个 WordPress 站点。这一切都取决于你。
我所说的“处理函数”是指您定义的自定义函数,用于处理调用特定自定义方法(不一定是默认的 WordPress 方法)的 XMLRPC 请求。例如,我在所有插件中使用 XMLRPC 来报告安装进度和错误 -
每个插件都会对我的服务器上的自定义处理程序(方法)进行 XMLRPC 调用。
是的,您可以检索并发布到自定义字段。
写一个插件绝对是正确的方法。唯一的其他选项是更改核心文件(坏主意)或将其构建到您的主题中,在这种情况下,它只能在使用该主题的 MU 网站上使用。将其构建为站点范围的 MU 插件,可由全局管理员逐个站点进行控制。
I've worked with WordPress' XMLRPC system before (using a WP-Hive installation with multiple separate blogs similar to a WPMU set-up). The new approach you're using is definitely simpler and easier to implement (I tried the 5ubliminal one as well the first time).
Whether or not you can distinguish between separate blogs in a MU installation depends entirely on how you build your handler function. You can build it to distinguish the separate blogs, to only function on specific blogs, or to treat the entire system as a single WordPress site. It's all up to you.
By "handler function" I mean a custom function you define to handle XMLRPC requests that call a specific, custom method (not necessarily the default WordPress methods). For example, I use XMLRPC in all my plug-ins to report back installation progress and errors -
each plug-in makes an XMLRPC call to a custom handler (method) on my server.
Yes, you can retrieve and post to custom fields.
Absolutely writing a plug-in is the way to go. The only other options are to change core files (BAD idea) or to build it into your theme, in which case it could ONLY be used on MU sites using that theme. Build it as a site-wide MU plug-in that can be controlled on a site-by-site basis by the global admin.
Wordpress XMLRPC 提供了各种可以轻松获取的功能。我使用 IXR_Library 来解析 XML 请求/响应。目前,通过非常小的代码,我可以轻松地在基于 WordPress 的博客中发布、获取、编辑和删除帖子,无论是自托管还是在 wordpress.com 网站上。
http://www.hurricanesoftwares.com /wordpress-xmlrpc-posting-content-from-outside-wordpress-admin-panel/(参考)
Wordpress XMLRPC offers various functionalities which can be harvested easily. I have used IXR_Library to parse the XML requests/responses. Currently with very small piece of code i can easily posts, fetch, edit and delete Posts in Wordpress based blogs either self hosted or on wordpress.com sites.
http://www.hurricanesoftwares.com/wordpress-xmlrpc-posting-content-from-outside-wordpress-admin-panel/ (reference)