Simple wordpress xmlrpc with IXR_Library Class

Simple wordpress xmlrpc with IXR_Library Class

XML RPC in wordpress function is activated automatically from wordpress version 3.5. By utilizing this function, we can send, edit, or delete posts without login to our wordpress blog dashboard.

IXR_Library Class is a PHP class that allows us to access the wordpress XMLRPC API. IXR_Library Class is a php class that created by incutio (for more documentation visit http://scripts.incutio.com/xmlrpc/ )

“The Incutio XML-RPC library (IXR) is designed primarily for ease of use. It incorporates both client and server classes, and is designed to hide as much of the workings of XML-RPC from the user as possible. A key feature of the library is automatic type conversion from PHP types to XML-RPC types and vice versa. This should enable developers to write web services with very little knowledge of the underlying XML-RPC standard.”

IXR_Library Class has several advantages (from IXR_Library Class official site)

  • A complete implementation of the XML-RPC specification
  • Written for PHP 4 in strict error reporting mode – no warnings or notices
  • Basic classes are designed to be usable in as little code as possible
  • Advanced classes extend the basic classes and provide additional features
  • Can be used with both Object Orientated and functional programming styles
  • Type conversions (PHP to XML-RPC and back again) are handled transparently
  • Built in support for system.getCapabilities
  • Built in support for system.listMethods
  • methodSignature and system.methodHelp are supported in an extension class
  • multicall is implemented in both the server and extended client classes
  • Follows the Specification for Fault Code Interoperability

 Why you should use IXR_Library Class? 

I myself use this class because of the ease of managing XML-RPC API MetaWeblog. If previously I had difficulty in using metaWeblog.newPost (specifically usage parameters date_created_gmt ) and metaWeblog.newMediaObject (specifically usage parameter bits ), with IXR_Library Class can be done by programming a more simple and effective.

 Example using wordpress xmlrpc with IXR_Library Class : 

$content = array(
                 'title'=>$title,
                 'description'=>$body,
                 'mt_allow_comments'=>0, // 1 to allow comments
                 'mt_allow_pings'=>0, // 1 to allow trackbacks
                 'post_type'=>'post',
                 'mt_keywords'=>$keywords,
                 'categories'=>array($category),
                 'custom_fields' => array($customfields) ,
		 'date_created_gmt' => $date
              );
	$params = array(1,'wordpress-username','wordpress-password',$content,true);
	$XmlRpc_result = $XmlRpc_client->query(
			'metaWeblog.newPost',$params
		);
	$data = $XmlRpc_client->getResponse();

You can download here

Okay, how to use XML-RPC API with IXR_Library Class MetaWeblog I will write in my upcoming posts 🙂

My list article about XMLRPC with MetaWeblog API

1. Remote posting wordpress with XML-RPC metaWeblog.newPost and IXR_Library Class.

2. How to Upload using WordPress MetaWeblog.newMediaObject and IXR_Library

3. Create New Category on WordPress with wp.newCategory and IXR_Library

4. How to use metaWeblog.getPost, metaWeblog.getRecentPosts and metaWeblog.deletePost

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

%d bloggers like this: