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

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

WordPress has supported MetaWeblog API that Allows external programs to get and set the text and attributes of weblog posts.To create a new posting remotely, requiring metaWeblog.newPost as XML-RPC API communication protocol. Read MetaWeblog API official site to the documentation

To be able to communicate with metaWeblog.newPost, a class IXR_Library required. Why do we use IXR_Library class? I have explained in the post Simple wordpress xmlrpc with IXR_Library Class.

 How to Using metaWeblog.newPost 

metaWeblog.newPost is use to create new post. For parameters used in metaWeblog.newPost you can read it from wordpress.org

Okay, lets begin my metaWeblog.newPost and IXR_Library tutorial

1. You need download IXR_Library here.
2. Create new php file as new_post.php and copy the code below

Explanation

the code above is one of the advantages of using IXR_Library. Using IXR_Date class allows us to set the post time.You can do the scheduling post as you want.

Syntax above is how to set parameter. Set true if you want publish the post, set false if you need set draft to your post status.

To use metaweblog.newpost use syntax $XmlRpc_client->query().

Use $data = $XmlRpc_client->getResponse() to get return value, the result of return value is postid as string.

Finish :), You can read my another XMLRPC article here or maybe you can combine metaWeblog.newPost  with amazon script to create auto post article from amazon .

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.

Latest posts by Sigit Prasetya Nugroho (see all)

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.