• Hey, I’m trying to figure out how to add tags/keywords (these terms are interchangeable, right?) when posting to my blog via PHP. Here is the function I’m using to post right now. It’s working great, but I want to programmatically add tags. Many thanks:

    <?php
    //DEFINE
    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);
    }
    //START
    wpPostXMLRPC(“May 14, 2011″,allMyHTMLGoesHere,”https://thisiswhatwecareabout.com/xmlrpc.php&#8221;,admin,fakePassword);

  • The topic ‘How to add tags when posting via PHP’ is closed to new replies.