Support » Plugins and Hacks » How to scedule a Post using XMLRPC wordpress

How to scedule a Post using XMLRPC wordpress

  • ironmankho


    i am using following php code for wordpress XML-RPC code it work well now

    ///////////////////////////////// xml-rpc code ////////////////////////
    $client->debug = true; //Set it to false in Production Environment
    $title=$movie_name  ;
    $body=$post; // $body will insert your blog content (article content)
    $category=$cat; // Comma seperated pre existing categories. Ensure that these   categories exists in your blog.
    $customfields=array('key'=>'Author-bio', 'value'=>'Autor Bio Here'); // Insert your custom values like this in Key, Value format
        $title = htmlentities($title,ENT_NOQUOTES,$encoding);
        $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);
        $body = preg_replace('/[^(\x20-\x7F)]*/','', $body);
    $realbody =  $body;
        $content = array(
            'mt_allow_comments'=>1,  // 1 to allow comments
            'mt_allow_pings'=>1,  // 1 to allow trackbacks
            'custom_fields' =>  array($customfields)
    // Create the client object
    $client = new IXR_Client('http://xxxxxx/xmlrpc.php');
     $username = "admin";
     $password = "xxxxxx";
     $params = array(0,$username,$password,$content,true); // Last parameter is 'true' which means post immideately, to save as draft set it as 'false'
    // Run a query for PHP
    if (!$client->query('metaWeblog.newPost', $params)) {
      die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());
       echo "Article Posted Successfully</br>";

    i want to add date publishing but unable to do my self i have info

    Create a new post. Parameters
    int blogid: Not applicable for WordPress, can be any value and will be ignored.
    string username
    string password
    struct content
        string title
        string description: Post content.
        string post_type: "post" or "page"
        datetime dateCreated†
        datetime date_created_gmt†: If specified, takes precedence over dateCreated.
        array categories: Names of categories assigned to the post.
        array mt_keywords: Names of tags assigned to the post.
        string mt_excerpt
        string mt_text_more: Post "Read more" text.
        string mt_allow_comments: "open" or "closed"
        string mt_allow_pings: "open" or "closed"
        string wp_slug†
        string wp_password†
        string wp_author_id†
        string wp_author_display_name†
        string post_status†
        string wp_post_format† (Added in WordPress 3.1)
        bool sticky† (Added in WordPress 2.7.1)
        array custom_fields† (Added in WordPress 2.3.2)
                string id: Optional.
                string key
                string value
        struct enclosure: Only set if post has an enclosure. (Added in WordPress 2.6.3)
            string url
            int length
            string type
    bool publish: Whether to publish the post upon creation or leave it as a draft. 
    Return Values
    string postid
  • The topic ‘How to scedule a Post using XMLRPC wordpress’ is closed to new replies.