See the Snippets! You can get productive in minutes or waste days and debug huge amounts of free and crappy code to get to 5% of elWpAPI's functionality.

WordPress Remote Control

WordPress XMLRPC Remote Publishing API (and beyond) by Easy-to-use PHP Objects

••• Hey there! Click here to buy, download or update the WpAPI library ONLY after you read the #3 Testimonials •••

WpAPI Versions

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

  1. wp.getUsersBlogs
  2. wp.getPage
  3. wp.getPages
  4. wp.newPage
  5. wp.deletePage
  6. wp.editPage
  7. wp.getPageList
  8. wp.getAuthors
  9. wp.getCategories
  10. wp.getTags
  11. wp.newCategory
  12. wp.deleteCategory
  13. wp.suggestCategories
  14. wp.uploadFile
  15. wp.getCommentCount
  16. wp.getPostStatusList
  17. wp.getPageStatusList
  18. wp.getPageTemplates
  19. wp.getOptions
  20. wp.setOptions
  21. wp.getComment
  22. wp.getComments
  23. wp.deleteComment
  24. wp.editComment
  25. wp.newComment
  26. wp.getCommentStatusList
  27. wp.getMediaItem
  28. wp.getMediaLibrary
  29. wp.getPostFormats

// Blogger API

  1. blogger.getUsersBlogs
  2. blogger.getUserInfo
  3. blogger.getPost
  4. blogger.getRecentPosts
  5. blogger.getTemplate
  6. blogger.setTemplate
  7. blogger.newPost
  8. blogger.editPost
  9. blogger.deletePost

// MetaWeblog API (with MT extensions to structs)

  1. metaWeblog.newPost
  2. metaWeblog.editPost
  3. metaWeblog.getPost
  4. metaWeblog.getRecentPosts
  5. metaWeblog.getCategories
  6. metaWeblog.newMediaObject

// MetaWeblog API aliases for Blogger API

  1. metaWeblog.deletePost
  2. metaWeblog.getTemplate
  3. metaWeblog.setTemplate
  4. metaWeblog.getUsersBlogs

// MovableType API

  1. mt.getCategoryList
  2. mt.getRecentPostTitles
  3. mt.getPostCategories
  4. mt.setPostCategories
  5. mt.supportedMethods
  6. mt.supportedTextFilters
  7. mt.getTrackbackPings
  8. 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);
?>