如何在 Wordpress 中获取带有 XML-RPC 的帖子?

发布于 2024-09-06 02:06:33 字数 391 浏览 4 评论 0原文

经过一番挖掘 Wordpress XML-RPC 文档后,似乎没有通过XML-RPC接口远程获取“帖子”(例如新闻文章)的方式。文档仅提到 wp.getPage - 如果我尝试将 PostID 传递给此方法,它会返回:

 [faultCode] => 404 [faultString] => Sorry, no such page. 

...但是当我传递有效的 PageID 时,wp.GetPage 显然可以工作。有谁知道我如何解决这个问题?理想情况下,无需在远程站点上扩展 XML-RPC 机制(因为访问这些机制可能很棘手)

After some digging around with the Wordpress XML-RPC documentation, it seems that there isn't a way to remotely obtain a "post" (such as a news article) through the XML-RPC interface. The documentation only mentions wp.getPage - if I try and pass in a PostID to this method, it returns:

 [faultCode] => 404 [faultString] => Sorry, no such page. 

... but wp.GetPage obviously does work when I pass a valid PageID. Does anyone have any ideas how I might go about solving this? Ideally, without extending the XML-RPC mechanism on the remote site (as access to these could be tricky)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

思念满溢 2024-09-13 02:06:33

我设法弄清楚了这一点。您可以使用“blogger.getPost”方法来完成此操作。 Wordpress 站点上对此没有太多文档,但是如果您查看 Wordpress 根目录中的 xmlrpc.php,您将找到 XML-RPC 函数的完整列表,包括:

        // Blogger API
        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
        'blogger.getUserInfo' => 'this:blogger_getUserInfo',
        'blogger.getPost' => 'this:blogger_getPost',
        'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
        'blogger.getTemplate' => 'this:blogger_getTemplate',
        'blogger.setTemplate' => 'this:blogger_setTemplate',
        'blogger.newPost' => 'this:blogger_newPost',
        'blogger.editPost' => 'this:blogger_editPost',
        'blogger.deletePost' => 'this:blogger_deletePost',

希望这对遇到此问题的任何人有所帮助未来。

I managed to figure this out. You can do this by using the "blogger.getPost" method. There isn't much documentation for this on the Wordpress site, but if you check out xmlrpc.php in the root of the Wordpress directory you will find a complete list of XML-RPC functions, including:

        // Blogger API
        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
        'blogger.getUserInfo' => 'this:blogger_getUserInfo',
        'blogger.getPost' => 'this:blogger_getPost',
        'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
        'blogger.getTemplate' => 'this:blogger_getTemplate',
        'blogger.setTemplate' => 'this:blogger_setTemplate',
        'blogger.newPost' => 'this:blogger_newPost',
        'blogger.editPost' => 'this:blogger_editPost',
        'blogger.deletePost' => 'this:blogger_deletePost',

Hope this helps anyone who struggles with this in future.

病女 2024-09-13 02:06:33

检查这个网站。它解释了 Blogger API 以及每个方法使用的参数:

http://xmlrpc.free -conversant.com/docs/bloggerAPI#newPost

Check this site out. It explains the Blogger API, and the parameters that each method consumes:

http://xmlrpc.free-conversant.com/docs/bloggerAPI#newPost

姐不稀罕 2024-09-13 02:06:33

我将 elWpAPI 重新定位到其自己的域。并对其进行了很多改进,包括媒体上传和 完全 WordPress 3.2.1 兼容性核心 API 和 rFC/rSQL 插件只是说...;)

道德上不相容的浏览器“错误”消失了。未能强制人们进入最低限度的隐私保护模式。

I relocated elWpAPI to its own domain. And improved it a lot, including media uploads and full WordPress 3.2.1 compatibility of both the Core API and the rFC/rSQL plugin. Just saying... ;)

And the morally incompatible browser 'error' is gone. Failed forcing people into minimal privacy defense mode.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文