3
我使用codeigniter张贴到我的WordPress的博客。wordpress metaWeblog.newPost xmlrpc创建类别,如果不存在,并防止重复标题codeigniter
代码
模型
function doPost($title='new post',$content='hi',$categories=array('new'),$keys='new, none')
{
$this->load->library('xmlrpc');
$thePost= array(
array(
'title' => array($title,'string'),
'date_created_gmt'=>array($datetime,'dateTime.iso8601'),
'description' => array($content,'string'),
'categories' => array($categories,'struct'),
'mt_keywords' => array($keys,'string'),
'post_type' => array('post','string'),
),
'struct'
);
$this->xmlrpc->server('http://demo.com/xmlrpc.php', 80);
$this->xmlrpc->method('metaWeblog.newPost');
$request = array('1',$user,$pass,$thePost,TRUE);
$this->xmlrpc->request($request);
$result = $this->xmlrpc->send_request();
if (!$result) {
echo $this->xmlrpc->display_error();
} else {
print_r($this->xmlrpc->display_response());
}
}
,但我有一个问题。
1st。我可以检查一个帖子是否已经存在相同的标题?
2nd。目前,如果我发布的类别不在那里,那么帖子被定义为未分类, 我如何改变这个以创建类别(如果不存在)?
3rd。我可以在一个xmlrpc请求中发布多个帖子吗?
感谢,我使用的最新版本的WordPress(今天是day0我与WordPress!)及其位于远程服务器上..
感谢感谢
你能解释我们如何在php中使用这个wp.newTerm? – 2013-11-02 21:08:57