更新时间:2023-09-08 16:22:22
很多咬牙,这似乎工作:
After much gnashing of teeth, this seems to work:
function doPost(){
$this->load->library('xmlrpc');
$bloguser = "theUserID";
$blogpass = "thePassword";
$blogid = 1;
$publishImmediately = TRUE;
$thePost = array(array('title' => array('this is the title','string'),
'description' => array('this is the description','string')
),
'struct');
$myPost = "my post";
//$this->xmlrpc->set_debug(TRUE);
$this->xmlrpc->server("http://url.to/xmlrpc.php", 80);
$this->xmlrpc->method('metaWeblog.newPost');
$request = array($blogid, $bloguser, $blogpass, $thePost, $publishImmediately);
$this->xmlrpc->request($request);
$result = $this->xmlrpc->send_request();
if ( !$result )
{
echo $this->xmlrpc->display_error();
}
else
{
echo '<pre>';
print_r($this->xmlrpc->display_response());
echo '</pre>';
}
}
重要的是注意元素的结构的实际职位。
The important part is to note the struct for the elements of the actual post.