Problem while posting using xml rpc

  • Unknown's avatar

    I am trying to make a post using xml rpc. Here is the code I am using:

    function wpPostXMLRPC($title, $body, $categories,$username,$password) {

    $rpcurl = ‘https://wpdem.wordpress.com/xmlrpc.php’;

    $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);
    echo ‘Request sent’;
    }

    It is not making a post using this. Although when I run the same code on my other site that is run no paid hosting, it is making posts using this.

    The blog I need help with is: (visible only to logged in users)

  • The topic ‘Problem while posting using xml rpc’ is closed to new replies.