Please watch the video first. An image is worth 1,000 words.
This video is almost 15 minutes long, 15 FPS = 13,500,000 words worth, to be precise!
1 | Amateur Version
This version implements all the WordPress core XMLRPC functions. This will be enough for most, especially for those using WordPress blogs hosted by others where they dont have full control and cannot install plugins.
// WordPress API
- wp.getUsersBlogs
- wp.getPage
- wp.getPages
- wp.newPage
- wp.deletePage
- wp.editPage
- wp.getPageList
- wp.getAuthors
- wp.getCategories
- wp.getTags
- wp.newCategory
- wp.deleteCategory
- wp.suggestCategories
- wp.uploadFile
- wp.getCommentCount
- wp.getPostStatusList
- wp.getPageStatusList
- wp.getPageTemplates
- wp.getOptions
- wp.setOptions
- wp.getComment
- wp.getComments
- wp.deleteComment
- wp.editComment
- wp.newComment
- wp.getCommentStatusList
- wp.getMediaItem
- wp.getMediaLibrary
- wp.getPostFormats
// Blogger API
- blogger.getUsersBlogs
- blogger.getUserInfo
- blogger.getPost
- blogger.getRecentPosts
- blogger.getTemplate
- blogger.setTemplate
- blogger.newPost
- blogger.editPost
- blogger.deletePost
// MetaWeblog API (with MT extensions to structs)
- metaWeblog.newPost
- metaWeblog.editPost
- metaWeblog.getPost
- metaWeblog.getRecentPosts
- metaWeblog.getCategories
- metaWeblog.newMediaObject
// MetaWeblog API aliases for Blogger API
- metaWeblog.deletePost
- metaWeblog.getTemplate
- metaWeblog.setTemplate
- metaWeblog.getUsersBlogs
// MovableType API
- mt.getCategoryList
- mt.getRecentPostTitles
- mt.getPostCategories
- mt.setPostCategories
- mt.supportedMethods
- mt.supportedTextFilters
- mt.getTrackbackPings
- mt.publishPost
See Basic Snippets to learn more.
2 | Professional Version
The Professional Version is designed for those who have experience in WordPress programming and have access to their blogs. A plugin requires installation and exposes most of the WordPress internal functions to easy XMLRPC calls. This way inserting a post is as easy as calling wp_insert_post through XMLRPC.
3 | Heavy-Duty Version
Does what Amateur and Professional do but slightly different and asynchronous (parallel). Hundreds/thousands of blogging operations can be executed in minutes, while Professional takes hours.
It also a little more advanced to code in async mode.
4 | Performance Considerations
Testing some heavy posting on the localhost these are some results:
- 250 posts with 100 threads took 33.940 seconds
- 250 posts with 50 threads took 38.575 seconds
- 250 posts with 25 threads took 29.384 seconds
- 250 posts with 1 threads took 151.378 seconds
You can notice the localhost paradox. Lower thread count = faster posting. Why? Because the bottleneck of the Serial API transfers to the local server and database. But spreading these requests to multiple servers (each handling one request not all), gives unimaginable performance compared to serial usage (not just 5x like here).
Testing Code
<?php
/**
* Run serial requests.
* Wrap in CUF to control variable lifespan.
*/
call_user_func(function($blog, $limit = 250){
$perf = microtime(true); // 151.378
$wpapi = new WpAPI_APIdec($blog);
for($i = 0; $i < $limit; $i++){
// Minimal post
$wpapi->quickPost('Title', 'Text');
} // for
$perf = microtime(true) - $perf;
echo number_format($perf, 3);
}, $blog, 250);
/**
* Run parallel requests.
* Wrap in CUF to control variable lifespan.
*/
call_user_func(function($blog, $limit = 250, $threads = 100){
$perf = microtime(true);
$queue = new WpAPI_Queue();
for($i = 0; $i < $limit; $i++){
// Minimal post
$request = WpAPI_Requests::blogger_newPost('Title', 'Text');
$queue->enqueueRequest($blog->openRequest($request));
} // for
$queue->executeRequests($threads, .1);
$perf = microtime(true) - $perf;
echo number_format($perf, 3);
}, $blog, 250, 100);
?>


