PHP XMLRPC library

Recently I played with php xml rpc library. My main goal is to post articles from php to wordpress blog.

There are a lot of implementation on the web.

First I tried the one on sourceforge.

I use the library to develop method to post a new articles or edit an existing article on a wordpress blog.

The sample code is like  this:

 $content['title'] = ”A post”
 $content['description'] = $article;
 $content['categories'] = “General”;
  $c = new xmlrpc_client(“/xmlrpc.php”, “localhost”, 80);
   $x = new xmlrpcmsg(“metaWeblog.newPost”,
   $c->return_type = ‘phpvals’;
   $r =$c->send($x);
   if ($r->errno==”0″)
    echo “Successfully Posted! articel ID:”;
    print $r->val;
     echo “xmlrpc meets some error”;

But when I tried to implement uploading images with metaWeblog.newMediaObject method, the library cannot support base64 value encoding correctly.

Then I realized the library used by wordpress itself should be a good candidate. It is actually from here:

$client = new IXR_Client(‘’);
if (!$client->query(‘test.getTime’)) {
   die(‘An error occurred – ‘.$client->getErrorCode().”:”.$client->getErrorMessage());
print $client->getResponse();

This library is more easily to use. Highly recommended!