$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)
);

//这块一定要加,解决中文乱码问题
$output_options = array(“output_type” => “xml”,”verbosity” => “pretty”,”escaping” => array(“markup”),”version” => “xmlrpc”,”encoding” => “utf-8”);

$params = array(0,$username,$password,$content,true);
$request = xmlrpc_encode_request(‘metaWeblog.newPost’,$params,$output_options);
$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;
}

>