Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am attempting to remotely post articles to a wordpress page and no matter what I attempt to do I cannot publish in the future and the past. I have commented out some past attempts (some found on here).

    $url = $rpcurl."/xmlrpc.php";


/*
Thanks, this is a life saver! If you need to provide tags for your post, you can pass them in array using tags_input property, like this:

$content['tags_input'] = "action, adventure, thriller";
If you need to pass in a specific time stamp, you should use the following format

D, d M Y H:i:s +0000
and pass it using the post_date or post_date_gmt property:

$content['post_date_gmt | post_date'] = date("D, d M Y H:i:s +0000", strtotime($your_specific_date_and_time));

*/  
error_reporting(E_ALL);
ini_set('display_errors', '1');


include("IXR_Library.inc.php"); // http://www.hurricanesoftwares.com/php_uploads/IXR_Library.txt

//$client->debug = true; //Set it to false in Production Environment I think

//$title="Blog Title5"; // $title variable will insert your blog title  or should
//$body = $content;

$title = htmlentities($title,ENT_NOQUOTES,$encoding);
$keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);
//$date = new IXR_Date( strtotime( '2015-12-25 09-20-58' ) );


//$pubdate = strtotime( '2015-04-08 13:46:43' ); 
//$pubdate = new IXR_Date( $pubdate );
$postdate = date('Y-m-d H:i:s', strtotime('2010-02-23 18:57:33'));
$test = new IXR_Date(time($postdate));

$content = array(
    'title'=>$title,
    'description'=>$body,
    'post_status'=>'future',
    'post_date' => $test,
    'mt_allow_comments'=>0,  // 1 to allow comments
    'mt_allow_pings'=>0,  // 1 to allow trackbacks
    'post_type'=>'post',
    'mt_keywords'=>$keywords2,
    'categories'=>array($category),
    //'custom_fields' =>  array($customfields)


);

// Create the client object
$client = new IXR_Client($url);


$params = array(0,$username,$password,$content,false); // 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());
}
else
echo "Article Posted Successfully";



?>
<?php
};



//global $post;
$my_post = array(
    'title'=>$title,
    'description'=>$body,
    'post_status'=> 'publish',
    'mt_allow_comments'=>0,  // 1 to allow comments
    'mt_allow_pings'=>0,  // 1 to allow trackbacks
    'post_type'=>'post',
    'mt_keywords'=>$keywords2,
    'categories'=>array($category),
);



/*


array();
$my_post['title']="title";
$my_post['description']="content";
//$my_post['ID'] = $ID;
$my_post['post_status'] =  'publish';
//$my_post['post_date'] =  '2015-12-25 09-20-58'; 
//$my_post['description'] = 'this is a test';
//$my_post['title'] = 'test 73';
//$my_post['excerpt'] = '64 ways';
//wp_update_post( $my_post );


*/    


/*
if(!$client->query('metaWeblog.newPost', $spam)){
    die('somethign went wrong -'.$client->getErrorCode().' : '.$client->getErrorMessage());
    }
    else
        echo "Article Posted Successfully WOOT!";
*/
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.