我試圖從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