14.05.2008 I updated this class adding a new post function metaWeblog compatible provided by Maximus Marius from seo 4you. I added a few tweaks to it, tested it and it works. You can now enjoy tags support. I also added another fix mentioned by netizen. All fixes are commented and credited in the source code.
Thanks guyz!

No matter what I need I code it myself. So I don't pay attention to pre-made blogs. But I thought a bit and tried WordPress. I still don't like it but I like the way you can play with it. Especially the automatition part implemented in XMLRPC. After looking into Wordpress a bit to implement the Pingback function I decided to go deeper.
I sat down and took a better look at the source file and the XMLRPC functions. Then implemented a 99% functional PHP Class to handle WordPress remotely using the provided APIs. I tested it and it works. Actually I did this with on single dirty thought in my mind: Blogfarms!
You can do anything with this class. You can put 100 blogs on steroids and post to them automatically with links to the posts of others. If you also send a pingback you might get a free comment that can do a lot for you!
You can even post machine generated content to them with links and so on. It's your imagination that needs to work from here on and of course … your coding skills!
I want you to share with me the uses you find for this class. It's a pre-condition to using it. The comment form is below. And Pssst … do notice the Teddy Bear on the right. If you hit the jackpot any donations will be appreciated. And remember to use the comment form below and let me know how it performs.

Click the box to get the PHP WordPress Auto-Posting Script!
<?
$wp = new eWordpressApi("http://www.blog.com/xmlrpc.php","username","password");
$title = "Post title";
$text = "Some post text";
$category = array(1,2); // Assuming you have categories with IDs: 1,2
$postID = $wp->newPost($title,$text,$category);
if(is_array($postID)) echo "Die, damn bug!";
?>
The script is built using the internal XMLRPC functions of PHP. It's required to have the module enabled. The script relies on the WordPress XMLRPC API which is a soup made of Blogger API, MovableType API, WordPress API and one more. I only used the first three.
It lacks the newPage function which is not really needed and I did not implement it … yet. Still post handling works perfectly as much as I tested it. If you find a bug yell! I'll look into it.
If should work with blogger.com but I never tested it. Only WordPress testing was done. So … hit me back if it works on Blogger. Remeber, on Blogger you need the APIid in the cunstructor changed to whatever you have.
Below you will find each function of the WordPress automatition class with it's informations. I should be easy to digest by any average coder. Don't ask me where to use it. Figure it out yourself:) And lemme know.
<?
function __construct($rpc, $user, $pass){
/* ---------------------------------------------------------------
For cunstruction use your username, password and URL of the XMLRPC
server : http://www.blog.com/xmlrpc.php . Check out tutorial on page
http://www.tellinya.com/art2/173/ for an autodiscovery function.
--------------------------------------------------------------- */
}
function eWordpressApi($rpc, $user, $pass){
/* Dummy constructor for older PHP (before 5) */
}
function doRpcRequest($url,$method,$params,$returnbool=0){
/* ---------------------------------------------------------------
Internal function that sends the request to the XMLRPC server.
To use a different XMLRPC implementation that the PHP one this
is where you have to play around!
--------------------------------------------------------------- */
}
function xml2Post($postXml){
/* ---------------------------------------------------------------
Internal function that convert XML representation of a Wordpress
post to a PHP array.
--------------------------------------------------------------- */
}
function xml2Page($postXml){
/* ---------------------------------------------------------------
Internal function that convert XML representation of a Wordpress
pager (like the About page) to a PHP array.
--------------------------------------------------------------- */
}
function post2Xml($title, $text, $categories){
/* ---------------------------------------------------------------
Internal function that converts a PHP array to XML representation
of a Wordpress post.
--------------------------------------------------------------- */
}
function getPost($postID,$mtFull=false){
/* ---------------------------------------------------------------
This function will retrieve a post from the blog. You need the POST
ID and the options $mtFull asks the script to use MovableType API
for extended informations compared to the Blogger API short version.
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function getPosts($postIDs,$mtFull=false){
/* ---------------------------------------------------------------
Helper function that does exactly as the above but takes an array
of IDs. Any of these 2 functions can be used for single integers or
arrays as they will call each other as needed.
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function deletePost($postID){
/* ---------------------------------------------------------------
This function will delete a POST by its ID.
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function deletePosts($postIDs){
/* ---------------------------------------------------------------
Helper function that does exactly as the above but takes an array
of IDs. Any of these 2 functions can be used for single integers or
arrays as they will call each other as needed.
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function newPost($postTitle, $postText, $postCategories, $publish=true){
/* ---------------------------------------------------------------
This function will post a new topic. Paramaters are selfexplanatory.
If $publish is true the post is published immediately otherwise
it's placed inside drafts. $postCategories is a numeric array or
a string with category IDs separated by ,
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function editPost($postID, $postTitle, $postText, $postCategories, $publish=true){
/* ---------------------------------------------------------------
This function will edit an existing post. Paramaters are selfexplanatory.
If $publish is true the post is published immediately otherwise
it's placed inside drafts. $postCategories is a numeric array or
a string with category IDs separated by ,
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function getRecentPosts($numPosts, $blogID=0){
/* ---------------------------------------------------------------
This function will get the latest POSTS including title, description
and categories. I advise against using it. Use the getRecentPostIDs
instead and then just query each ID to get post info.
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function getRecentPostIDs($numPosts, $blogID=0){
/* ---------------------------------------------------------------
This function will get the latest POSTS IDs so you can query each
of them to get post info useing getPost().
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function getAllPosts($blogID=0){
/* ---------------------------------------------------------------
This function is a helper function. The getRecentPosts with $numPosts
set to 0 will return the same thing. All the POSTS.
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function getAllPostIDs($blogID=0){
/* ---------------------------------------------------------------
This function is a helper function. The getRecentPostIDs with $numPosts
set to 0 will return the same thing. All the POSTS IDs.
--------------------------------------------------------------- */
// - Blogger Type API Function -
}
function getPage($pageID,$blogID=0){
/* ---------------------------------------------------------------
This function will get a page by ID. A page is not a post. It's
like the About page. You know better.
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function deletePage($pageID,$blogID=0){
/* ---------------------------------------------------------------
This function will delete a page. It returns an array of undeleted
pages or true.
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function deletePages($pageIDs,$blogID=0){
/* ---------------------------------------------------------------
Helper function that does exactly as the above but takes an array
of IDs. Any of these 2 functions can be used for single integers or
arrays as they will call each other as needed. It returns an array
of undeleted pages or true.
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function listPages($blogID=0){
/* ---------------------------------------------------------------
This function will list pages with short info about them.
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function getPages($blogID=0){
/* ---------------------------------------------------------------
This function will list pages with longer info about them.
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function getPageIDs($blogID=0){
/* ---------------------------------------------------------------
This function will list only page IDs so you can query further
informations using getPage().
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
;
function getCategories($blogID=0){
/* ---------------------------------------------------------------
This function will list categories with details using wordPress API
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function getCategoryIDs($blogID=0){
/* ---------------------------------------------------------------
This function will list only category ID and name. It returns an
array $entry[$categoryID]=$categoryName. Use IDs for new POSTs
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function newCategory($categoryName,$blogID=0){
/* ---------------------------------------------------------------
This function will create a new category.
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function getAuthors($blogID=0){
/* ---------------------------------------------------------------
This function will list Authors of Blog.
--------------------------------------------------------------- */
// - WordPress Type API Function -
}
function publishPost($postID){
/* ---------------------------------------------------------------
This function will Publish posts from Drafts.
--------------------------------------------------------------- */
// - MovableType Type API Function -
}
?>
It's best to leave default parameters untouched unless you know what you're doing. I have the bad habbit of using functions in my code decalred in other libraries I include by default. So if this won't work and you have XMLRPC enabled let me know where it fails so I can add the missing functions. Had no time / mood to double check it:)
Hope you enjoy it, don't forget the Teddy Bear on the right and any comments / linkbacks are mandatory welcome. Regards.
";print_r(...);echo ""; :)
Post Feedback