善忘技术夹 Logo
善忘技术夹
技术文章 · 1581 阅读

使用xml-rpc发布wordpress日志

From Evernote:


class-wp-xmlrpc-server.php 这是wordpress里的提供xml-rpc功能的一个类,想用java实现发布日志的功能 ,本来想直接用提

Clipped from: http://sily.sinaapp.com/wp-admin/options-writing.php

class-wp-xmlrpc-server.php 这是wordpress里的提供xml-rpc功能的一个类,想用java实现发布日志的功能 ,本来想直接用提供的

通过电子邮件发布

功能, 可是, 不管怎么设置, 就是不起作用, 没有办法, 看到 xml-rpc的支持 ,就直接用 这个来实现了, 开始用

// MetaWeblog API (with MT extensions to structs)

这个基本上能实现发日志的功能 ,不过还有些功能没有实现, 比如说创建目录什么的,分类。这些都是用到了wordpress自己提供的

api功能, 今天看到文件里面有写到一些方法 ,测试了一下, 都可以用 , 有时间好好用用。

一下是部分代码

                  // WordPress API
                  'wp.getUsersBlogs'          => 'this:wp_getUsersBlogs',
                  'wp.getPage'               => 'this:wp_getPage',
                  'wp.getPages'               => 'this:wp_getPages',
                  'wp.newPage'               => 'this:wp_newPage',
                  'wp.deletePage'               => 'this:wp_deletePage',
                  'wp.editPage'               => 'this:wp_editPage',
                  'wp.getPageList'          => 'this:wp_getPageList',
                  'wp.getAuthors'               => 'this:wp_getAuthors',
                  'wp.getCategories'          => 'this:mw_getCategories',          // Alias
                  'wp.getTags'               => 'this:wp_getTags',
                  'wp.newCategory'          => 'this:wp_newCategory',
                  'wp.deleteCategory'          => 'this:wp_deleteCategory',
                  'wp.suggestCategories'     => 'this:wp_suggestCategories',
                  'wp.uploadFile'               => 'this:mw_newMediaObject',     // Alias
                  'wp.getCommentCount'     => 'this:wp_getCommentCount',
                  'wp.getPostStatusList'     => 'this:wp_getPostStatusList',
                  'wp.getPageStatusList'     => 'this:wp_getPageStatusList',
                  'wp.getPageTemplates'     => 'this:wp_getPageTemplates',
                  'wp.getOptions'               => 'this:wp_getOptions',
                  'wp.setOptions'               => 'this:wp_setOptions',
                  'wp.getComment'               => 'this:wp_getComment',
                  'wp.getComments'          => 'this:wp_getComments',
                  'wp.deleteComment'          => 'this:wp_deleteComment',
                  'wp.editComment'          => 'this:wp_editComment',
                  'wp.newComment'               => 'this:wp_newComment',
                  'wp.getCommentStatusList' => 'this:wp_getCommentStatusList',
                  'wp.getMediaItem'          => 'this:wp_getMediaItem',
                  'wp.getMediaLibrary'     => 'this:wp_getMediaLibrary',
                  'wp.getPostFormats'     => 'this:wp_getPostFormats',
  
                  // 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',
  
                  // MetaWeblog API (with MT extensions to structs)
                  'metaWeblog.newPost' => 'this:mw_newPost',
                  'metaWeblog.editPost' => 'this:mw_editPost',
                  'metaWeblog.getPost' => 'this:mw_getPost',
                  'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
                  'metaWeblog.getCategories' => 'this:mw_getCategories',
                  'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
  
                  // MetaWeblog API aliases for Blogger API
                  // see http://www.xmlrpc.com/stories/storyReader$2460
                  'metaWeblog.deletePost' => 'this:blogger_deletePost',
                  'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
                  'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
                  'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
  
                  // MovableType API
                  'mt.getCategoryList' => 'this:mt_getCategoryList',
                  'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
                  'mt.getPostCategories' => 'this:mt_getPostCategories',
                  'mt.setPostCategories' => 'this:mt_setPostCategories',
                  'mt.supportedMethods' => 'this:mt_supportedMethods',
                  'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
                  'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
                  'mt.publishPost' => 'this:mt_publishPost',
  
                  // PingBack
                  'pingback.ping' => 'this:pingback_ping',
                  'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
  
                  'demo.sayHello' => 'this:sayHello',
                  'demo.addTwoNumbers' => 'this:addTwoNumbers'
 


 


  

用到的java包文件

commons-logging-1.1.jar ws-commons-util-1.0.2.jar xmlrpc-client-3.1.3.jar xmlrpc-common-3.1.3.jar xmlrpc-server-3.1.3.jar

apache的xmlrpc的提供的xmlrpc工具包 *[HTML]: HyperText Markup Language