哪个 XML-RPC 库?
PHP 至少有两种 XML-RPC 实现。哪个最好,为什么?
- 我一直在使用 O'Reilly 水母书中基于 Edd Dumbill 的作品的一个,但我找到了它非常尴尬和冗长并且很难调试。
- 内置于 PHP 的版本看起来更干净一些,但包含以下警告:扩展是实验性的。
你最喜欢的?另一种?
There are at least two implementations of XML-RPC for PHP. Which is best and why?
- I've been using the one based on Edd Dumbill's work in the O'Reilly jellyfish book, but I find it extraordinarily awkward and verbose and very hard to debug.
- The version built into PHP looks a bit cleaner, but contains warnings that the extension is experimental.
Your favorite? A different one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
XML-RPC 主要与数据编组有关,因此本机 PHP 扩展和纯 PHP 实现之间的性能差异可以忽略不计。然而,PHP 内置函数仅用于编码数据,因此您需要一个附加 API 来实际发送 RPC 调用。
UsefulIncs xmlrpc 库是容易受到 eval 攻击的库。所以无论今天看起来如何,我都会避开它。最好使用本机 PHP xmlrpc_* 函数并忘记实验标签。
另一种选择是 Zend Frameworks XmlRpc 函数,它是纯函数PHP 代码过于冗长,但经过时间考验。就我个人而言,我曾经有一个自定义的 XML-RPC 库,它也执行内容编码等,但今天我会使用 ZendFrameworks、HordeFramework 或 PEARs XMLRPC2。 (但很高兴现在我们主要使用 JSON。)
XML-RPC is mostly about marshalling data, so performance differences between the native PHP extension and pure PHP implementations is negligible. The PHP builtin is however just about encoding data, so you need an add-on API to actually send RPC calls.
UsefulIncs xmlrpc library was the one susceptible to eval exploits. So I'd eschew that regardless of what it looks today. Better use the native PHP xmlrpc_* functions and forget about the experimental tag.
An alternative would be Zend Frameworks XmlRpc functions, which are pure PHP code and overly verbose, but time-tested. Personally I once had a custom XML-RPC lib which also performed Content-Encoding et al, but today I'd use ZendFrameworks, HordeFramework or PEARs XMLRPC2. (But am glad we can mostly use JSON nowadays.)
内置版本(xmlrpc-epi)可以工作。它在旧版本的 PHP 中存在一些有趣的错误,但从 PHP 5.3.2 开始应该没问题。我编写了一个非常简单的库,称为 Ripcord,它使用内置版本,但可以解决旧 PHP 版本中最烦人的错误。请参阅 http://ripcord.googlecode.com/
The built-in version (xmlrpc-epi) works. It has some interesting bugs in older versions of PHP but you should be fine as of PHP 5.3.2. I've written a really simple library, called Ripcord, that uses the built-in version but works around the most annoying bugs in older PHP versions. See http://ripcord.googlecode.com/