我试图从extrnal php代码发布到wordpress博客,我所有的文件都在同一个目录public_html。发布到wordpress与CURL
这是我的代码:
function wpPostXMLRPC1($title,$body,$rpcurl,$username,$password,$category,$keywords='',$encoding='UTF-8') {
$title = htmlentities($title,ENT_NOQUOTES,$encoding);
$keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);
$content = array(
'title'=>$title,
'description'=>$body,
'mt_allow_comments'=>0, // 1 to allow comments
'mt_allow_pings'=>0, // 1 to allow trackbacks
'post_type'=>'post',
'mt_keywords'=>$keywords,
'categories'=>array($category)
);
$params = array(0,$username,$password,$content,true);
$request = xmlrpc_encode_request('metaWeblog.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);
$results = curl_exec($ch);
curl_close($ch);
return $results;
}
,但其错误,错误的是
Fatal error: Call to undefined function xmlrpc_encode_request()
我可以张贴到我与Microsoft Word(发布 - >博客帖子)的WordPress博客,帮帮我吧
和无法理解,请求的'xmlrpc_encode_request'函数未在服务器上安装或激活。 – 2011-05-07 17:53:44