WordPress.org

Ready to get started?Download WordPress

Forums

Getting started with xml-rpc or atom publising protocal (2 posts)

  1. ocon
    Member
    Posted 5 years ago #

    Hello,

    I'm trying to integrate my wordpress installation with my main site using a php script to publish pushed content into wordpress.

    This weekend I was playing around with xml-rpc, trying to figure it out, but from what I found, there doesn't seem to be a lot of white papers or script examples for it.

    After enabeling xml-rpc in my wordpress blog, I was able to publish using a script I found:

    function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories=array(1)){
    $categories = implode(",", $categories);
    $XML = "<title>$title</title>".
    "<category>$categories</category>".
    $body;
    $params = array('','',$username,$password,$XML,1);
    $request = xmlrpc_encode_request('blogger.newPost',$params);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    curl_setopt($ch, CURLOPT_URL, $rpcurl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1);
    curl_exec($ch);
    curl_close($ch);
    }

    This works great, but I've moved beyond what this script provides. I was hoping someone can tell me if the script above is even the right approach to publishing to wordpress using xml-rpc.

    If so, I can't figure out a way to have pictures uploaded to the site using curl, or add tags, or even change a publishing date (to back date older content from my archive), if any of these are possible.

    Also, I was hoping someone might be able to share with me how atom publishing differs to xml-rpc, and if there are any advantages or disadvantages to one over the other.

    Thank you so much

  2. Joseph Scott
    Member
    Posted 5 years ago #

    WordPress uses the PHP library IXR - http://scripts.incutio.com/xmlrpc/ - for XML-RPC, which includes a client portion. Using that will make things much easier for sending XML-RPC requests.

    The metaWeblog.* methods are well supported in WordPress, as well as a number of WordPress specific methods - http://codex.wordpress.org/XML-RPC_wp

    XML-RPC compared to AtomPub, there are numerous differences. While they both use XML to encode the data shipped back and forth, the basic methods for exchanging data and actions are very different.

    Currently WordPress provides more features and capabilities via XML-RPC than AtomPub.

Topic Closed

This topic has been closed to new replies.

About this Topic