wordpress XML-RPC UTF-8

时间:2015-01-28 18:23:43

标签: wordpress utf-8 xml-rpc

我正在使用XML-RPC添加帖子,它的效果很好但字符不正确(utf-8)

我正在使用这个

<?php
include('IXR_Library.php');
$client = new IXR_Client('http://localhost/wordpress2/xmlrpc.php');

        $content['title'] = 'Test title '.mt_rand();
        $content['categories'] = array("NewCategory","Nothing");
        $content['description'] = '<p>Lorem ?rmak ipsum dolor sit amet</p>';
        $content['custom_fields'] = array( array('key' => 'my_custom_fied','value'=>'yes') );
        $content['mt_keywords'] = array('foo','bar');
        $params = array(0, 'user','pass',$content,true);

//        if (!$client->query(xmlrpc_encode_request('metaWeblog.newPost',$params, array('encoding'=>'UTF-8','escaping'=>'markup')))) {
          if (!$client->query('metaWeblog.newPost',$params)) {
            die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());
        }
        $ID =  $client->getResponse();

        if($ID)
        {
            echo 'Post published with ID:#'.$ID;
        }

?>

我认为使用xmlrpc_encode_request但不能正常工作

xmlrpc_encode_request('metaWeblog.newPost',$params, array('encoding'=>'UTF-8','escaping'=>'markup'))

我将如何解决这个问题?

0 个答案:

没有答案