Edit a post on WordPress remotely with XML-RPC and PHP

For the sake of this exercise, I am assuming that you have a clear understanding of what XML-RPC is. If not, read more about it here. I am also assuming that XML-RPC is enabled on your wordpress blog and you have the required IXR_Library.php.inc downloaded from here.

The code below is self-explanatory.

 // Update a Selected Post
 $title = "Updated Title"; // The Title of the Post
 $bodycontent = "Updated Blog Article Content"; // Article Content
 $categoriesu = array('Category1', 'Category2'); // Pre Existing Categories - Updated
 $tagsu = "tag1, tag2, $tag3"; // Updated Tags
 $content = array('title'=>$title, 'description'=>$bodycontent, 'categories'=>$categoriesu, 'mt_keywords'=>$tagsu); 
 $params = array(100,$username,$password,$content,1); // First Parameter is mandatory Post Id (get your post id via Recent Blogs entries)
// Run a query for PHP
if (!$client->query('metaWeblog.editPost', $params)) {
    die('Something went wrong - '.$client>getErrorCode().' : '.$client->getErrorMessage());

Say Hello! Don’t be shy.